diff options
author | Yifeng Sun <pkusunyifeng@gmail.com> | 2018-01-12 09:45:31 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-01-22 16:39:18 -0800 |
commit | a34eba019c4a247e96b3aaed24ce6d11fa5ec372 (patch) | |
tree | cbfe9354c000305c05b4f7265602f500e7efac2c /ovsdb | |
parent | 22407d311344ae32dfd2533fd332605b5407ea61 (diff) | |
download | openvswitch-a34eba019c4a247e96b3aaed24ce6d11fa5ec372.tar.gz |
ovsdb-client: Fix memory leaks
This two leaks are reported by valgrind (testing ovsdb-client
backup and restore):
890 (56 direct, 834 indirect) bytes in 1 blocks are definitely lost in loss record 71 of 73
by 0x42DE22: xcalloc (util.c:103)
by 0x40DD8C: ovsdb_schema_create (ovsdb.c:34)
by 0x40E0B5: ovsdb_schema_from_json (ovsdb.c:196)
by 0x406DA5: fetch_schema (ovsdb-client.c:415)
by 0x408478: do_restore (ovsdb-client.c:1595)
by 0x405BCD: main (ovsdb-client.c:170)
2,688 (88 direct, 2,600 indirect) bytes in 1 blocks are definitely lost in loss record 73 of 73
by 0x42DE84: xmalloc (util.c:120)
by 0x40E61F: ovsdb_create (ovsdb.c:329)
by 0x40BA22: ovsdb_file_open__ (file.c:201)
by 0x40845A: do_restore (ovsdb-client.c:1592)
by 0x405BCD: main (ovsdb-client.c:170)
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r-- | ovsdb/ovsdb-client.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 0ab4d66f1..faa6bdb4d 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -1612,6 +1612,7 @@ do_restore(struct jsonrpc *rpc, const char *database, VLOG_INFO("%s", ds_cstr(&s)); ds_destroy(&s); } + ovsdb_schema_destroy(schema2); struct json *txn = json_array_create_empty(); json_array_add(txn, json_string_create(schema->name)); @@ -1653,6 +1654,7 @@ do_restore(struct jsonrpc *rpc, const char *database, json_array_add(txn, ins_op); } } + ovsdb_destroy(backup); struct jsonrpc_msg *rq = jsonrpc_create_request("transact", txn, NULL); struct jsonrpc_msg *reply; check_txn(jsonrpc_transact_block(rpc, rq, &reply), &reply); |