ovn-nbctl: Fix leak of ovsdb_idl_txn.
authorRussell Bryant <rbryant@redhat.com>
Wed, 1 Apr 2015 17:40:07 +0000 (13:40 -0400)
committerBen Pfaff <blp@nicira.com>
Wed, 1 Apr 2015 23:24:03 +0000 (16:24 -0700)
A new transaction is allocated before executing the command.  If the
result from committing the transaction is TRY_AGAIN, the code leaked
the allocated transaction since it creates a new one when it comes
back around to retry.  The old transaction is now destroyed before
continuing to allow the command to be retried.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovn/ovn-nbctl.c

index 06cfa2f..10fa5f8 100644 (file)
@@ -614,6 +614,8 @@ main(int argc, char *argv[])
             ovs_cmdl_run_command(&ctx, get_all_commands());
             txn_status = ovsdb_idl_txn_commit_block(nb_ctx.txn);
             if (txn_status == TXN_TRY_AGAIN) {
+                ovsdb_idl_txn_destroy(nb_ctx.txn);
+                nb_ctx.txn = NULL;
                 continue;
             } else {
                 break;