[libvirt] [PATCH 03/17] Fix leak in virDomainVcpuPinDefParseXML parsing cpumask

Daniel P. Berrange berrange at redhat.com
Tue Sep 24 16:03:53 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

If the virBitmapParse method fails due to OOM, we leak
the 'tmp' variable string.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/conf/domain_conf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ccb61aa..aab6781 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10614,8 +10614,10 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
         int cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
 
         if (virBitmapParse(set, 0, &def->cpumask,
-                           cpumasklen) < 0)
-           goto error;
+                           cpumasklen) < 0) {
+            VIR_FREE(tmp);
+            goto error;
+        }
         VIR_FREE(tmp);
     } else {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
1.8.3.1




More information about the libvir-list mailing list