On Tue, 2010-05-18 at 12:09 +0200, Jim Meyering wrote:
Hence, the lack of anything to free "ret" when this function returns
NULL constitutes a leak.
Here's the patch:
>From 4c13990a15b33f03595d58b46b6e34e03bfffa65 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 12:05:53 +0200
Subject: [PATCH] virNWFilterDefParseXML: avoid leak on error paths
* src/conf/nwfilter_conf.c (virNWFilterDefParseXML): Also free "ret"
via cleanup.
---
src/conf/nwfilter_conf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index ea73a33..fc6d461 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -1767,6 +1767,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) {
return ret;
cleanup:
+ virNWFilterDefFree(ret);
VIR_FREE(chain);
VIR_FREE(uuid);
return NULL;
Correct. ACK.
Stefan