diff mbox

[ovs-dev,4/8] ovsdb-idl: Fix memory leak

Message ID 1491601426-77274-4-git-send-email-yihung.wei@gmail.com
State Accepted
Headers show

Commit Message

Yi-Hung Wei April 7, 2017, 9:43 p.m. UTC
In testcase "simple idl, conditional, multiple clauses in condition - C",
valgrind reports a memory leak with the following call stack.
    xmalloc (util.c:112)
    resize (hmap.c:100)
    ovsdb_idl_condition_clone (ovsdb-idl.c:1075)
    ovsdb_idl_set_condition (ovsdb-idl.c:1095)
    update_conditions (test-ovsdb.c:2299)
    do_idl (test-ovsdb.c:2388)
    ovs_cmdl_run_command__ (command-line.c:115)
    main (test-ovsdb.c:73)

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 lib/ovsdb-idl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff April 24, 2017, 4:30 p.m. UTC | #1
On Fri, Apr 07, 2017 at 02:43:42PM -0700, Yi-Hung Wei wrote:
> In testcase "simple idl, conditional, multiple clauses in condition - C",
> valgrind reports a memory leak with the following call stack.
>     xmalloc (util.c:112)
>     resize (hmap.c:100)
>     ovsdb_idl_condition_clone (ovsdb-idl.c:1075)
>     ovsdb_idl_set_condition (ovsdb-idl.c:1095)
>     update_conditions (test-ovsdb.c:2299)
>     do_idl (test-ovsdb.c:2388)
>     ovs_cmdl_run_command__ (command-line.c:115)
>     main (test-ovsdb.c:73)
> 
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>

Thanks, I applied this to master, branch-2.7, and branch-2.6.
Timothy Redaelli April 26, 2017, 4:21 p.m. UTC | #2
On 04/24/2017 06:30 PM, Ben Pfaff wrote:
> On Fri, Apr 07, 2017 at 02:43:42PM -0700, Yi-Hung Wei wrote:
>> In testcase "simple idl, conditional, multiple clauses in condition - C",
>> valgrind reports a memory leak with the following call stack.
>>     xmalloc (util.c:112)
>>     resize (hmap.c:100)
>>     ovsdb_idl_condition_clone (ovsdb-idl.c:1075)
>>     ovsdb_idl_set_condition (ovsdb-idl.c:1095)
>>     update_conditions (test-ovsdb.c:2299)
>>     do_idl (test-ovsdb.c:2388)
>>     ovs_cmdl_run_command__ (command-line.c:115)
>>     main (test-ovsdb.c:73)
>>
>> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
> 
> Thanks, I applied this to master, branch-2.7, and branch-2.6.

Hi,
unlucky this commit breaks build on branch-2.6 since the function
"ovsdb_idl_condition_destroy" was added in commit
0164e367f5d8 ("ovsdb-idl: Change interface to conditional monitoring.")
and it's not available on branch 2.6.
Ben Pfaff April 26, 2017, 7:57 p.m. UTC | #3
On Wed, Apr 26, 2017 at 06:21:34PM +0200, Timothy M. Redaelli wrote:
> On 04/24/2017 06:30 PM, Ben Pfaff wrote:
> > On Fri, Apr 07, 2017 at 02:43:42PM -0700, Yi-Hung Wei wrote:
> >> In testcase "simple idl, conditional, multiple clauses in condition - C",
> >> valgrind reports a memory leak with the following call stack.
> >>     xmalloc (util.c:112)
> >>     resize (hmap.c:100)
> >>     ovsdb_idl_condition_clone (ovsdb-idl.c:1075)
> >>     ovsdb_idl_set_condition (ovsdb-idl.c:1095)
> >>     update_conditions (test-ovsdb.c:2299)
> >>     do_idl (test-ovsdb.c:2388)
> >>     ovs_cmdl_run_command__ (command-line.c:115)
> >>     main (test-ovsdb.c:73)
> >>
> >> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
> > 
> > Thanks, I applied this to master, branch-2.7, and branch-2.6.
> 
> Hi,
> unlucky this commit breaks build on branch-2.6 since the function
> "ovsdb_idl_condition_destroy" was added in commit
> 0164e367f5d8 ("ovsdb-idl: Change interface to conditional monitoring.")
> and it's not available on branch 2.6.

Oops.  Thanks for the report.  For now, I reverted this from branch-2.6.
diff mbox

Patch

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 48b3af0d8855..c79951f82281 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -327,6 +327,7 @@  ovsdb_idl_destroy(struct ovsdb_idl *idl)
 
         for (i = 0; i < idl->class->n_tables; i++) {
             struct ovsdb_idl_table *table = &idl->tables[i];
+            ovsdb_idl_condition_destroy(&table->condition);
             shash_destroy(&table->columns);
             hmap_destroy(&table->rows);
             free(table->modes);