summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamijan Skvarc <damjan.skvarc@gmail.com>2019-09-30 09:40:48 +0200
committerBen Pfaff <blp@ovn.org>2019-09-30 13:37:36 -0700
commita8d36f944ba5517052ae66dd7356d963259e5b28 (patch)
treefe331b2f808502ecc7153063fe886cb86d9c69c1
parentf634ab671167f49ede0957238f8fc1455444449e (diff)
downloadopenvswitch-a8d36f944ba5517052ae66dd7356d963259e5b28.tar.gz
ovsdb-client: fix memory leak in is_database_clustered() function.
Memory leak is reported while running test suite. It is evidenced with the following report: ==18447== 1,868 (48 direct, 1,820 indirect) bytes in 1 blocks are definitely lost in loss record 45 of 45 ==18447== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==18447== by 0x449C02: xcalloc (util.c:121) ==18447== by 0x432949: jsonrpc_msg_from_json (jsonrpc.c:697) ==18447== by 0x432A8F: jsonrpc_parse_received_message (jsonrpc.c:472) ==18447== by 0x432A8F: jsonrpc_recv.part.7 (jsonrpc.c:338) ==18447== by 0x432D0B: jsonrpc_recv (jsonrpc.c:297) ==18447== by 0x432D0B: jsonrpc_recv_block (jsonrpc.c:402) ==18447== by 0x4330BB: jsonrpc_transact_block (jsonrpc.c:436) ==18447== by 0x40A7C1: is_database_clustered (ovsdb-client.c:1624) ==18447== by 0x40AE3F: do_needs_conversion (ovsdb-client.c:1670) ==18447== by 0x405F76: main (ovsdb-client.c:282) Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--ovsdb/ovsdb-client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index bfc90e6f7..784e2da68 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -1627,7 +1627,9 @@ is_database_clustered(struct jsonrpc *rpc, const char *database)
const struct json *row = parse_database_info_reply(
reply, jsonrpc_get_name(rpc), database, NULL);
- return !strcmp(parse_string_column(row, "model"), "clustered");
+ bool clustered = !strcmp(parse_string_column(row, "model"), "clustered");
+ jsonrpc_msg_destroy(reply);
+ return clustered;
}
static void