render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From b63d4e603a3617bd0d68d8897afb5e1c13a75165 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <b63d4e603a3617bd0d68d8897afb5e1c13a75165@dist-git>
c480ed
From: John Ferlan <jferlan@redhat.com>
c480ed
Date: Tue, 2 Jul 2019 12:57:21 +0200
c480ed
Subject: [PATCH] cpu_x86: Fix memory leak - virCPUx86GetHost
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
Commit 56b254dcc called virCPUx86DataAdd, but returned -1 directly
c480ed
without calling the virCPUx86DataFree.
c480ed
c480ed
Found by Coverity.
c480ed
c480ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
c480ed
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
(cherry picked from commit 5acb4eede23bcd5bc75193ea21542e0fb04b6e45)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
c480ed
c480ed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
Message-Id: <96135f1275b80b251c83ca947333b1969380ef7b.1562064911.git.jdenemar@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/cpu/cpu_x86.c | 2 +-
c480ed
 1 file changed, 1 insertion(+), 1 deletion(-)
c480ed
c480ed
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
c480ed
index 0a520f07ff..9104bdbf1e 100644
c480ed
--- a/src/cpu/cpu_x86.c
c480ed
+++ b/src/cpu/cpu_x86.c
c480ed
@@ -2789,7 +2789,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
c480ed
             };
c480ed
 
c480ed
             if (virCPUx86DataAdd(cpuData, &item) < 0)
c480ed
-                return -1;
c480ed
+                goto cleanup;
c480ed
         }
c480ed
     }
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed