提交 e6bb6220 编写于 作者: Z Zhang Bo 提交者: Michal Privoznik

tests: free ChardevInfo correctly in qemumonitorjsontest

The free callback should be qemuMonitorChardevInfoFree rather
than just 'free' when virHashCreate'ing the chardevInfo hash.

==29959== 24 bytes in 2 blocks are definitely lost in loss record 19 of 53
==29959==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29959==    by 0xB95C679: strdup (in /lib64/libc-2.20.so)
==29959==    by 0x63C6546: virStrdup (virstring.c:709)
==29959==    by 0x4805ED: qemuMonitorJSONExtractChardevInfo (qemu_monitor_json.c:3429)
==29959==    by 0x4807A5: qemuMonitorJSONGetChardevInfo (qemu_monitor_json.c:3479)
==29959==    by 0x434AEC: testQemuMonitorJSONqemuMonitorJSONGetChardevInfo (qemumonitorjsontest.c:1824)
==29959==    by 0x436F2F: virtTestRun (testutils.c:211)
==29959==    by 0x436932: mymain (qemumonitorjsontest.c:2404)
==29959==    by 0x4382EA: virtTestMain (testutils.c:863)
==29959==    by 0x436B27: main (qemumonitorjsontest.c:2423)
Signed-off-by: NZhang Bo <oscar.zhangbo@huawei.com>
Signed-off-by: NZhou Yimin <zhouyimin@huawei.com>
上级 6f5d29f4
......@@ -28,7 +28,7 @@
#include "virerror.h"
#include "virstring.h"
#include "cpu/cpu.h"
#include "qemu/qemu_monitor.h"
#define VIR_FROM_THIS VIR_FROM_NONE
......@@ -1782,7 +1782,7 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(const void *data)
if (!test)
return -1;
if (!(info = virHashCreate(32, (virHashDataFree) free)) ||
if (!(info = virHashCreate(32, qemuMonitorChardevInfoFree)) ||
!(expectedInfo = virHashCreate(32, NULL)))
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册