Skip to content

Commit

Permalink
ovn-northd-ddlog: Fix memory leaks.
Browse files Browse the repository at this point in the history
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@ovn.org>
Reported-by: Numan Siddique <numans@ovn.org>
Acked-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
blp committed Mar 24, 2021
1 parent 82bdb19 commit 00dce6a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions northd/ovn-northd-ddlog.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 00dce6a

Please sign in to comment.