render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 871079dd76ebdcff9ccc1cbbdbed660ef2a3f8b1 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <871079dd76ebdcff9ccc1cbbdbed660ef2a3f8b1@dist-git>
9119d9
From: Jiri Denemark <jdenemar@redhat.com>
9119d9
Date: Thu, 8 Jan 2015 14:48:05 +0100
9119d9
Subject: [PATCH] conf: Fix memory leak when parsing invalid network XML
9119d9
9119d9
Don't leak the value of /network/bridge/macTableManager if it's invalid.
9119d9
9119d9
The fix is a small part of upstream commit 3aa05241, which commit
9119d9
40961978 backported to 7.1 relied on.
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1180136
9119d9
---
9119d9
 src/conf/network_conf.c | 3 ++-
9119d9
 1 file changed, 2 insertions(+), 1 deletion(-)
9119d9
9119d9
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
9119d9
index 8015bf3..7b19592 100644
9119d9
--- a/src/conf/network_conf.c
9119d9
+++ b/src/conf/network_conf.c
9119d9
@@ -2021,7 +2021,7 @@ static virNetworkDefPtr
9119d9
 virNetworkDefParseXML(xmlXPathContextPtr ctxt)
9119d9
 {
9119d9
     virNetworkDefPtr def;
9119d9
-    char *tmp;
9119d9
+    char *tmp = NULL;
9119d9
     char *stp = NULL;
9119d9
     xmlNodePtr *ipNodes = NULL;
9119d9
     xmlNodePtr *routeNodes = NULL;
9119d9
@@ -2342,6 +2342,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
9119d9
     return def;
9119d9
 
9119d9
  error:
9119d9
+    VIR_FREE(tmp);
9119d9
     VIR_FREE(routeNodes);
9119d9
     VIR_FREE(stp);
9119d9
     virNetworkDefFree(def);
9119d9
-- 
9119d9
2.2.1
9119d9