Skip to content

Commit

Permalink
ovsdb-client: Fix memory leaks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yifsun authored and blp committed Jan 23, 2018
1 parent 22407d3 commit a34eba0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ovsdb/ovsdb-client.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a34eba0

Please sign in to comment.