diff mbox

[ovs-dev] ovn-nbctl, tests: Clean up noisy memory leaks

Message ID 1473424607-29288-1-git-send-email-rmoats@us.ibm.com
State Accepted
Headers show

Commit Message

Ryan Moats Sept. 9, 2016, 12:36 p.m. UTC
When run with valgrind, ovn-nbctl.c and tests/test-ovn.c reveal
memory leaks of their own.  This patch cleans these up so that
they don't create noise when looking for leaks in the OVN daemon
processes.

Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
---
 ovn/utilities/ovn-nbctl.c | 1 +
 tests/test-ovn.c          | 4 ++++
 2 files changed, 5 insertions(+)

Comments

Ben Pfaff Sept. 9, 2016, 7:59 p.m. UTC | #1
On Fri, Sep 09, 2016 at 07:36:47AM -0500, Ryan Moats wrote:
> When run with valgrind, ovn-nbctl.c and tests/test-ovn.c reveal
> memory leaks of their own.  This patch cleans these up so that
> they don't create noise when looking for leaks in the OVN daemon
> processes.
> 
> Signed-off-by: Ryan Moats <rmoats@us.ibm.com>

Applied to master and branch-2.6, thanks!
diff mbox

Patch

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index d6d64ea..a37fe51 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -1608,6 +1608,7 @@  nbctl_lr_route_add(struct ctl_context *ctx)
         }
 
         if (!may_exist) {
+            free(rt_prefix);
             ctl_fatal("duplicate prefix: %s", prefix);
         }
 
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 0ef09ab..8e9aa15 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -328,6 +328,7 @@  test_dump_symtab(struct ovs_cmdl_context *ctx OVS_UNUSED)
         ds_destroy(&s);
     }
 
+    free(nodes);
     expr_symtab_destroy(&symtab);
     shash_destroy(&symtab);
 }
@@ -1227,6 +1228,8 @@  test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED)
             }
             expr_destroy(prereqs2);
 
+            ovnacts_free(ovnacts2.data, ovnacts2.size);
+            ofpbuf_uninit(&ovnacts2);
             ds_destroy(&ovnacts_s);
         } else {
             printf("    %s\n", error);
@@ -1234,6 +1237,7 @@  test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED)
         }
 
         expr_destroy(prereqs);
+        ovnacts_free(ovnacts.data, ovnacts.size);
         ofpbuf_uninit(&ovnacts);
     }
     ds_destroy(&input);