valgrind detects this leak while running functional test "ovsdb-client backup and restore"
==25401== 1,068 (240 direct, 828 indirect) bytes in 6 blocks are definitely lost in loss record 22 of 22
==25401== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25401== by 0x449DA4: xmalloc (util.c:138)
==25401== by 0x43012D: json_create (json.c:1451)
==25401== by 0x43012D: json_array_create_empty (json.c:186)
==25401== by 0x43012D: json_parser_push_array (json.c:1279)
==25401== by 0x4303CF: json_parser_input (json.c:1407)
==25401== by 0x4312F1: json_lex_input (json.c:991)
==25401== by 0x43193B: json_parser_feed (json.c:1149)
==25401== by 0x4329FA: jsonrpc_recv.part.7 (jsonrpc.c:332)
==25401== by 0x432D3B: jsonrpc_recv (jsonrpc.c:297)
==25401== by 0x432D3B: jsonrpc_recv_block (jsonrpc.c:402)
==25401== by 0x4330EB: jsonrpc_transact_block (jsonrpc.c:436)
==25401== by 0x409246: do_backup (ovsdb-client.c:2008)
==25401== by 0x405F76: main (ovsdb-client.c:282)
the problem was in db_backup() function, where _uuid json node was detached from
its parent "row" json node, but never destroyed afterwards.
Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
char uuid_s[UUID_LEN + 1];
snprintf(uuid_s, sizeof uuid_s, UUID_FMT, UUID_ARGS(&atom.uuid));
json_object_put(output_rows, uuid_s, json_clone(row));
+ json_destroy(uuid_json);
}
json_object_put(output_txn, table_name, output_rows);
}