Blob Blame History Raw
From b63d4e603a3617bd0d68d8897afb5e1c13a75165 Mon Sep 17 00:00:00 2001
Message-Id: <b63d4e603a3617bd0d68d8897afb5e1c13a75165@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Tue, 2 Jul 2019 12:57:21 +0200
Subject: [PATCH] cpu_x86: Fix memory leak - virCPUx86GetHost
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit 56b254dcc called virCPUx86DataAdd, but returned -1 directly
without calling the virCPUx86DataFree.

Found by Coverity.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5acb4eede23bcd5bc75193ea21542e0fb04b6e45)

https://bugzilla.redhat.com/show_bug.cgi?id=1697627

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <96135f1275b80b251c83ca947333b1969380ef7b.1562064911.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/cpu/cpu_x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 0a520f07ff..9104bdbf1e 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2789,7 +2789,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
             };
 
             if (virCPUx86DataAdd(cpuData, &item) < 0)
-                return -1;
+                goto cleanup;
         }
     }
 
-- 
2.22.0