The json read from file is never freed in ovsdb-tool show-log
for a clustered database:

 ERROR: LeakSanitizer: detected memory leaks

 Direct leak of 10774760 byte(s) in 269369 object(s) allocated from:
    0 0x50cc32 in malloc (ovsdb/ovsdb-tool+0x50cc32)
    1 0x6e7b6b in xmalloc__ lib/util.c:140:15
    2 0x6e7b6b in xmalloc lib/util.c:175:12
    3 0x6494f6 in json_create lib/json.c:1489:25
    4 0x64a8a7 in json_object_create lib/json.c:263:25
    5 0x6525f3 in json_parser_push_object lib/json.c:1311:25
    6 0x6525f3 in json_parser_input lib/json.c:1409:13
    7 0x64f6c4 in json_parser_feed lib/json.c:1126:17
    8 0x5694b5 in parse_body ovsdb/log.c:412:9
    9 0x5694b5 in ovsdb_log_read ovsdb/log.c:477:13
   10 0x54d294 in do_show_log_cluster ovsdb/ovsdb-tool.c:1069:27
   11 0x54d294 in do_show_log ovsdb/ovsdb-tool.c:1115:9
   12 0x63b7b1 in ovs_cmdl_run_command__ lib/command-line.c:247:17
   13 0x5488a5 in main ovsdb/ovsdb-tool.c:82:5
   14 0xe0eb49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49)
   15 0xe0ec0a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0a)
   16 0x471fe4 in _start (ovsdb/ovsdb-tool+0x471fe4)

Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered 
databases.")
Reported-by: Dumitru Ceara <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
---
 ovsdb/ovsdb-tool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index e26536532..facd680ff 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -1094,6 +1094,7 @@ do_show_log_cluster(struct ovsdb_log *log)
             free(s);
         }
 
+        json_destroy(json);
         putchar('\n');
     }
 
-- 
2.40.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to