While running virdbustest, it was found that valgrind pointed out
the following memory leaks:
==9996== 17 (8 direct, 9 indirect) bytes in 1 blocks are definitely lost in loss record 9
of 36
==9996== at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==9996== by 0x4A06B62: realloc (vg_replace_malloc.c:662)
==9996== by 0x4C6B587: virReallocN (viralloc.c:245)
==9996== by 0x4C6B6AE: virExpandN (viralloc.c:294)
==9996== by 0x4C82B54: virDBusMessageDecodeArgs (virdbus.c:907)
==9996== by 0x4C83463: virDBusMessageDecode (virdbus.c:1141)
==9996== by 0x402C45: testMessageArrayRef (virdbustest.c:273)
==9996== by 0x404E71: virtTestRun (testutils.c:201)
==9996== by 0x401C2D: mymain (virdbustest.c:479)
==9996== by 0x4055ED: virtTestMain (testutils.c:789)
==9996== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==9996==
==9996== 28 (16 direct, 12 indirect) bytes in 1 blocks are definitely lost in loss record
12 of 36
==9996== at 0x4A06BE0: realloc (vg_replace_malloc.c:662)
==9996== by 0x4C6B587: virReallocN (viralloc.c:245)
==9996== by 0x4C6B6AE: virExpandN (viralloc.c:294)
==9996== by 0x4C82B54: virDBusMessageDecodeArgs (virdbus.c:907)
==9996== by 0x4C83463: virDBusMessageDecode (virdbus.c:1141)
==9996== by 0x402C45: testMessageArrayRef (virdbustest.c:273)
==9996== by 0x404E71: virtTestRun (testutils.c:201)
==9996== by 0x401C2D: mymain (virdbustest.c:479)
==9996== by 0x4055ED: virtTestMain (testutils.c:789)
==9996== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==9996==
---
tests/virdbustest.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tests/virdbustest.c b/tests/virdbustest.c
index 1870f35..bdb1c24 100644
--- a/tests/virdbustest.c
+++ b/tests/virdbustest.c
@@ -250,6 +250,7 @@ static int testMessageArrayRef(const void *args ATTRIBUTE_UNUSED)
size_t out_nstrv2 = 0;
const char *in_str2 = "World";
char *out_str1 = NULL, *out_str2 = NULL;
+ size_t i = 0;
if (!(msg = dbus_message_new_method_call("org.libvirt.test",
"/org/libvirt/test",
@@ -315,6 +316,12 @@ static int testMessageArrayRef(const void *args ATTRIBUTE_UNUSED)
VIR_FREE(out_int32);
VIR_FREE(out_str1);
VIR_FREE(out_str2);
+ for (i = 0; i < out_nstrv1; i++)
+ VIR_FREE(out_strv1[i]);
+ VIR_FREE(out_strv1);
+ for (i = 0; i < out_nstrv2; i++)
+ VIR_FREE(out_strv2[i]);
+ VIR_FREE(out_strv2);
dbus_message_unref(msg);
return ret;
}
--
1.7.1