[pve-devel] applied: [PATCH cluster 2/2] check_memdb: free data to allow building with memory leak sanitizer

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Aug 29 19:48:05 CEST 2019


while this "memory leak" was irrelevant (short running anyway, so the
OS could clean up after us just fine) let's free the malloced stuff
nonetheless - this allows to build with -fsanitize=address and
-fsanitize=undefined

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/src/check_memdb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/data/src/check_memdb.c b/data/src/check_memdb.c
index 7111279..38fe221 100644
--- a/data/src/check_memdb.c
+++ b/data/src/check_memdb.c
@@ -97,6 +97,8 @@ START_TEST(test_indextest1)
 	g_checksum_update(sha256, (unsigned char *)idx, idx->bytes);
 	const char *csum = g_checksum_get_string(sha256);
 	fail_unless(strcmp(csum, "913fd95015af9d93f10dd51ba2a7bb11351bcfe040be21e95fcba834adc3ec10") == 0, "wrong idx checksum %s", csum);
+	g_free(idx);
+	g_free(testdata);
 
 }
 END_TEST
@@ -160,6 +162,7 @@ START_TEST (test_filetest1)
 	fail_unless(memdb_read(memdb, fn, &data) == 10);
 
 	fail_unless(strncmp(data, "012X45X789", 10) == 0);
+	g_free(data);
 
 	fail_unless(memdb_delete(memdb, fn, 0, ctime) == 0);
 
-- 
2.20.1





More information about the pve-devel mailing list