]> git.proxmox.com Git - pve-cluster.git/commitdiff
check_memdb: free data to allow building with memory leak sanitizer
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Aug 2019 17:45:18 +0000 (19:45 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Aug 2019 17:47:45 +0000 (19:47 +0200)
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@proxmox.com>
data/src/check_memdb.c

index 711127987164915fe3c7de18b6a625cd236ceb51..38fe2215768fd6a902d0a4637e0c34b67b44b7fc 100644 (file)
@@ -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);