[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

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

Signed-off-by: Daniel P. Berrange <berrange 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]