summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYifeng Sun <pkusunyifeng@gmail.com>2017-10-31 10:52:09 -0700
committerBen Pfaff <blp@ovn.org>2017-11-02 14:20:55 -0700
commitee816a9ccfb743c3fa5a2f68684a2bbc2ec48df0 (patch)
treefc8afee5037df43207dffa1e50caff133f18fbe6 /tests
parent17b85cd9b3d2abb9b7270c7d7daaffa82d77a565 (diff)
downloadopenvswitch-ee816a9ccfb743c3fa5a2f68684a2bbc2ec48df0.tar.gz
test-ovsdb: Fix memory leak
Valgrind testcase 1465 (integer atom enum from string) reports the leak below: 16 bytes in 1 blocks are definitely lost in loss record 2 of 5 at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x43F5F4: xmalloc (util.c:120) by 0x424AC6: alloc_default_atoms (ovsdb-data.c:315) by 0x4271E0: ovsdb_atom_from_string__ (ovsdb-data.c:508) by 0x4271E0: ovsdb_atom_from_string (ovsdb-data.c:632) by 0x40ADCC: do_parse_atom_strings (test-ovsdb.c:566) by 0x41BA73: ovs_cmdl_run_command__ (command-line.c:115) by 0x4051C9: main (test-ovsdb.c:72) range_end_atom is allocated in ovsdb_atom_from_string__() and no one is holding a reference to it at the end of do_parse_atom_strings(). It should be freed here, as also pointed out by ovsdb_atom_destroy(). Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ovsdb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
index 451172cdc..a33cc8fba 100644
--- a/tests/test-ovsdb.c
+++ b/tests/test-ovsdb.c
@@ -582,6 +582,7 @@ do_parse_atom_strings(struct ovs_cmdl_context *ctx)
ovsdb_atom_destroy(&atom, base.type);
if (range_end_atom) {
ovsdb_atom_destroy(range_end_atom, base.type);
+ free(range_end_atom);
}
}
ovsdb_base_type_destroy(&base);