diff options
author | Jakub Sitnicki <jkbs@redhat.com> | 2018-07-09 16:40:06 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-09 16:42:08 -0700 |
commit | a9f55784c347c3a4081d3fdfe0330c62b08270fe (patch) | |
tree | 5b7714fd8cf78ac3fb0752b14edd9c67f04e9e57 /ovn/utilities | |
parent | aaf0016add4f049e86d9572589ae9ab6232e2db8 (diff) | |
download | openvswitch-a9f55784c347c3a4081d3fdfe0330c62b08270fe.tar.gz |
ovn-nbctl, ovn-sbctl, ovs-vsctl: Don't dup error message just to report it.
Get rid of a pointless copy operation.
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn/utilities')
-rw-r--r-- | ovn/utilities/ovn-nbctl.c | 6 | ||||
-rw-r--r-- | ovn/utilities/ovn-sbctl.c | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 1181cdfba..bd82eb1b7 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -4126,7 +4126,6 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, struct ctl_command *c; struct shash_node *node; int64_t next_cfg = 0; - char *error = NULL; txn = the_idl_txn = ovsdb_idl_txn_create(idl); if (dry_run) { @@ -4205,7 +4204,6 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, } } } - error = xstrdup(ovsdb_idl_txn_get_error(txn)); switch (status) { case TXN_UNCOMMITTED: @@ -4224,7 +4222,7 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, goto try_again; case TXN_ERROR: - ctl_fatal("transaction error: %s", error); + ctl_fatal("transaction error: %s", ovsdb_idl_txn_get_error(txn)); case TXN_NOT_LOCKED: /* Should not happen--we never call ovsdb_idl_set_lock(). */ @@ -4233,7 +4231,6 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, default: OVS_NOT_REACHED(); } - free(error); ovsdb_symbol_table_destroy(symtab); @@ -4309,7 +4306,6 @@ try_again: table_destroy(c->table); free(c->table); } - free(error); return false; } diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c index 5f76b5e6a..c47cf6df9 100644 --- a/ovn/utilities/ovn-sbctl.c +++ b/ovn/utilities/ovn-sbctl.c @@ -1260,7 +1260,6 @@ do_sbctl(const char *args, struct ctl_command *commands, size_t n_commands, struct sbctl_context sbctl_ctx; struct ctl_command *c; struct shash_node *node; - char *error = NULL; txn = the_idl_txn = ovsdb_idl_txn_create(idl); if (dry_run) { @@ -1331,7 +1330,6 @@ do_sbctl(const char *args, struct ctl_command *commands, size_t n_commands, } } } - error = xstrdup(ovsdb_idl_txn_get_error(txn)); switch (status) { case TXN_UNCOMMITTED: @@ -1350,7 +1348,7 @@ do_sbctl(const char *args, struct ctl_command *commands, size_t n_commands, goto try_again; case TXN_ERROR: - ctl_fatal("transaction error: %s", error); + ctl_fatal("transaction error: %s", ovsdb_idl_txn_get_error(txn)); case TXN_NOT_LOCKED: /* Should not happen--we never call ovsdb_idl_set_lock(). */ @@ -1359,7 +1357,6 @@ do_sbctl(const char *args, struct ctl_command *commands, size_t n_commands, default: OVS_NOT_REACHED(); } - free(error); ovsdb_symbol_table_destroy(symtab); @@ -1416,7 +1413,6 @@ try_again: table_destroy(c->table); free(c->table); } - free(error); return false; } |