render / rpms / libvirt

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