summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2010-10-22 17:25:02 -0700
committerJustin Pettit <jpettit@nicira.com>2010-10-22 17:25:02 -0700
commitb7b6e2c44e2aba714f09f7f1587919a4df2f6666 (patch)
tree52b7db40acba1fc4742163f91cdb9b8dadb34b45
parentbcd49a457fc7586f6bb496e71aec7a7564a271f1 (diff)
downloadopenvswitch-b7b6e2c44e2aba714f09f7f1587919a4df2f6666.tar.gz
ovs-vsctl: Prevent double-free when retrying a transaction
-rw-r--r--utilities/ovs-vsctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 1585faee5..c4f628e12 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -2838,7 +2838,7 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
}
error = xstrdup(ovsdb_idl_txn_get_error(txn));
ovsdb_idl_txn_destroy(txn);
- the_idl_txn = NULL;
+ txn = the_idl_txn = NULL;
unused = ovsdb_symbol_table_find_unused(symtab);
if (unused) {
@@ -2927,8 +2927,10 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
try_again:
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
- ovsdb_idl_txn_abort(txn);
- ovsdb_idl_txn_destroy(txn);
+ if (txn) {
+ ovsdb_idl_txn_abort(txn);
+ ovsdb_idl_txn_destroy(txn);
+ }
ovsdb_symbol_table_destroy(symtab);
for (c = commands; c < &commands[n_commands]; c++) {
ds_destroy(&c->output);