Message ID | MEYP282MB330223A45EC293DAFC52CCA5CD189@MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] ovsdb-tool.c : Fix memory leak report by coverity | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot | success | github build: passed |
On Fri, Jul 09, 2021 at 11:44:01AM +0000, lin huang wrote: > Call json_destroy() after json_object_create. > > Signed-off-by: linhuang <linhuang@ruijie.com.cn> Thanks, applied.
diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index 7a8997bba..05a0223e7 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -1508,12 +1508,16 @@ do_check_cluster(struct ovs_cmdl_context *ctx) if (!must_equal || raft_entry_equals(ae, be)) { continue; } - char *as = json_to_string(raft_entry_to_json(ae), JSSF_SORT); - char *bs = json_to_string(raft_entry_to_json(be), JSSF_SORT); + struct json *jae = raft_entry_to_json(ae); + struct json *jbe = raft_entry_to_json(be); + char *as = json_to_string(jae, JSSF_SORT); + char *bs = json_to_string(jbe, JSSF_SORT); ovs_fatal(0, "log entries with index %"PRIu64" differ:\n" "%s has %s\n" "%s has %s", idx, a->filename, as, b->filename, bs); + json_destroy(jae); + json_destroy(jbe); } } }
Call json_destroy() after json_object_create. Signed-off-by: linhuang <linhuang@ruijie.com.cn> --- ovsdb/ovsdb-tool.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)