[libvirt] PATCH: 0/12: Modular build & node devices integration

Jim Meyering jim at meyering.net
Fri Nov 14 17:47:13 UTC 2008

"Daniel P. Berrange" <berrange at redhat.com> wrote:
> The following series of patches are updated version of patches 7-11 of
> this series
>  http://www.redhat.com/archives/libvir-list/2008-October/msg00718.html
> And integrating David Lively's node device patches ontop

Hi Dan,

I built that and ran "make check" under valgrind.
There were two leaks in the result, though I'm not sure
the leaks are new with this patch series.  Here's one of them
(the other was similar):

249,136 (1,840 direct, 247,296 indirect) bytes in 115 blocks are definitely lost
in loss record 6 of 7
   at 0x4A05174: calloc (vg_replace_malloc.c:397)
   by 0x423C4A: virAlloc (memory.c:100)
   by 0x426E93: virHashCreate (hash.c:96)
   by 0x43724C: virGetConnect (datatypes.c:131)
   by 0x409B64: testCompareFormatXML (xmconfigtest.c:114)
   by 0x409D7B: testCompareHelper (xmconfigtest.c:172)
   by 0x40AD66: virtTestRun (testutils.c:92)
   by 0x409EC9: mymain (xmconfigtest.c:208)
   by 0x40B426: virtTestMain (testutils.c:443)

Here's the fix:

>From df72657ae1a6d16f1722d1517ec1a1f4ab1e302e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 14 Nov 2008 18:43:48 +0100
Subject: [PATCH] tests: don't leak connection references

* tests/xmconfigtest.c (testCompareFormatXML): Use virUnrefConnect(conn),
not VIR_FREE(conn).
(testCompareParseXML): Likewise.
 tests/xmconfigtest.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 276a2e4..b88637f 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -93,7 +93,7 @@ static int testCompareParseXML(const char *xmcfg, const char *xml,
     if (conf)
-    VIR_FREE(conn);
+    virUnrefConnect(conn);

     return ret;
@@ -146,7 +146,7 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml,
-    VIR_FREE(conn);
+    virUnrefConnect(conn);

     return ret;

More information about the libvir-list mailing list