render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
404507
From 7d3283c2747833de50eab930209c16896885761a Mon Sep 17 00:00:00 2001
404507
Message-Id: <7d3283c2747833de50eab930209c16896885761a@dist-git>
404507
From: Martin Kletzander <mkletzan@redhat.com>
404507
Date: Fri, 2 Feb 2018 15:21:26 +0100
404507
Subject: [PATCH] util: Fix possible leak in virResctrlAllocMasksAssign
404507
404507
Found by coverity.
404507
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
(cherry picked from commit 679543449c0488f3b6f4c5671eee70a86cfa03ec)
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1540817
404507
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
---
404507
 src/util/virresctrl.c | 4 ++--
404507
 1 file changed, 2 insertions(+), 2 deletions(-)
404507
404507
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
404507
index e1c4998f71..70426199ce 100644
404507
--- a/src/util/virresctrl.c
404507
+++ b/src/util/virresctrl.c
404507
@@ -1444,10 +1444,10 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
404507
 
404507
     alloc_default = virResctrlAllocGetDefault(resctrl);
404507
     if (!alloc_default)
404507
-        return -1;
404507
+        goto cleanup;
404507
 
404507
     if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0)
404507
-        return -1;
404507
+        goto cleanup;
404507
 
404507
     for (level = 0; level < alloc->nlevels; level++) {
404507
         virResctrlAllocPerLevelPtr a_level = alloc->levels[level];
404507
-- 
404507
2.16.1
404507