[libvirt] [PATCH 1/3] util: Fix possible leak in virResctrlAllocMasksAssign

Martin Kletzander posted 3 patches 7 years, 3 months ago
[libvirt] [PATCH 1/3] util: Fix possible leak in virResctrlAllocMasksAssign
Posted by Martin Kletzander 7 years, 3 months ago
Found by coverity.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 src/util/virresctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index e1c4998f7151..70426199ce20 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -1444,10 +1444,10 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
 
     alloc_default = virResctrlAllocGetDefault(resctrl);
     if (!alloc_default)
-        return -1;
+        goto cleanup;
 
     if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0)
-        return -1;
+        goto cleanup;
 
     for (level = 0; level < alloc->nlevels; level++) {
         virResctrlAllocPerLevelPtr a_level = alloc->levels[level];
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] util: Fix possible leak in virResctrlAllocMasksAssign
Posted by Peter Krempa 7 years, 3 months ago
On Fri, Feb 02, 2018 at 08:23:32 +0100, Martin Kletzander wrote:
> Found by coverity.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  src/util/virresctrl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list