[ovs-dev] [PATCH ovn] ovn-nbctl: Fix leak of ovsdb_idl_txn.

Russell Bryant rbryant at redhat.com
Wed Apr 1 17:40:07 UTC 2015


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 at redhat.com>
---
 ovn/ovn-nbctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ovn/ovn-nbctl.c b/ovn/ovn-nbctl.c
index 06cfa2f..10fa5f8 100644
--- a/ovn/ovn-nbctl.c
+++ b/ovn/ovn-nbctl.c
@@ -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;
-- 
2.1.0




More information about the dev mailing list