]> git.proxmox.com Git - ovs.git/commitdiff
ovsdb-idl: Fix memory leak of ovsdb_idl_db_clear.
authorHan Zhou <hzhou8@ebay.com>
Wed, 6 Mar 2019 02:16:50 +0000 (18:16 -0800)
committerBen Pfaff <blp@ovn.org>
Fri, 8 Mar 2019 00:48:53 +0000 (16:48 -0800)
ovsdb_idl_row_destroy() doesn't free the memory of row structure itself.
This is because of the ovsdb change tracking feature: the deleted row
may be accessed in the current iteration of main loop. The function
ovsdb_idl_row_destroy_postprocess() is called at the end of
ovsdb_idl_run() to free the deleted rows that are not tracked; the
function ovsdb_idl_db_track_clear() is called (indirectly) by user
at the end of each main loop iteration to free the deleted rows that
are tracked. However, in ovsdb_idl_db_clear(), which may be called when
a session is reset, or when the idl is destroyed, it didn't call
ovsdb_idl_row_destroy_postprocess(), which would result in all the
untracked rows leaked. This patch fixes that.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/ovsdb-idl.c

index ed2b30a0849ce38d17fe8b7c10e18cefc84b9611..29cb80e964efe58fec5e44e6476257e2da8fbf8b 100644 (file)
@@ -617,6 +617,7 @@ ovsdb_idl_db_clear(struct ovsdb_idl_db *db)
             ovsdb_idl_row_destroy(row);
         }
     }
+    ovsdb_idl_row_destroy_postprocess(db);
 
     db->cond_changed = false;
     db->cond_seqno = 0;