[libvirt] [PATCH 4/4] tests: fix some resource leaks

Ján Tomko jtomko at redhat.com
Tue Apr 11 10:51:03 UTC 2017


On Mon, Apr 10, 2017 at 09:54:00AM +0200, Pavel Hrdina wrote:
>Found by running valgrind for these tests.
>
>Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
>---
> tests/commandtest.c    | 3 +++
> tests/domaincapstest.c | 2 ++
> tests/fchosttest.c     | 2 ++
> tests/vircgroupmock.c  | 2 ++
> 4 files changed, 9 insertions(+)
>
>diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
>index f871197c25..b76332ce94 100644
>--- a/tests/domaincapstest.c
>+++ b/tests/domaincapstest.c
>@@ -563,6 +563,8 @@ mymain(void)
>     DO_TEST_BHYVE("fbuf", "/usr/sbin/bhyve", &bhyve_caps, VIR_DOMAIN_VIRT_BHYVE);
> #endif /* WITH_BHYVE */
>
>+    virObjectUnref(cfg);
>+
>     return ret;
> }
>

The cfg variable is defined inside an #if WITH_QEMU block, so the unref
should be inside one too.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170411/4175432a/attachment-0001.sig>


More information about the libvir-list mailing list