[ovs-dev] [PATCH ovn 1/3] ovn-northd-ddlog: Fix memory leaks.

Ben Pfaff blp at ovn.org
Wed Mar 10 00:24:38 UTC 2021


ddlog_delta_get_table() returns data that must be freed, but the code
in northd_update_probe_interval() did not do that.  This fixes it.

In addition, the accumulated deltas weren't freed when the daemon exits.
This doesn't really matter but it's cleaner to do so, so this commit
also does that.

Signed-off-by: Ben Pfaff <blp at ovn.org>
Reported-by: Numan Siddique <numans at ovn.org>
---
 northd/ovn-northd-ddlog.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/northd/ovn-northd-ddlog.c b/northd/ovn-northd-ddlog.c
index 238987410239..be3de5cee29e 100644
--- a/northd/ovn-northd-ddlog.c
+++ b/northd/ovn-northd-ddlog.c
@@ -577,6 +577,7 @@ northd_update_probe_interval(struct northd_ctx *nb, struct northd_ctx *sb)
     table_id tid = ddlog_get_table_id("Northd_Probe_Interval");
     ddlog_delta *probe_delta = ddlog_delta_get_table(delta, tid);
     ddlog_delta_enumerate(probe_delta, northd_update_probe_interval_cb, (uintptr_t) &probe_interval);
+    ddlog_free_delta(probe_delta);
 
     ovsdb_cs_set_probe_interval(nb->cs, probe_interval);
     ovsdb_cs_set_probe_interval(sb->cs, probe_interval);
@@ -1230,6 +1231,7 @@ main(int argc, char *argv[])
     northd_ctx_destroy(nb_ctx);
     northd_ctx_destroy(sb_ctx);
 
+    ddlog_free_delta(delta);
     ddlog_stop(ddlog);
 
     if (replay_fd >= 0) {
-- 
2.29.2



More information about the dev mailing list