[libvirt] [PATCH 1/2] cpu_x86: Fix memory leak - virCPUx86GetHost

John Ferlan jferlan at redhat.com
Fri Jun 21 19:43:36 UTC 2019


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

Found by Coverity.

Signed-off-by: John Ferlan <jferlan at 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 71fc365139..978a60c90a 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2791,7 +2791,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
             };
 
             if (virCPUx86DataAdd(cpuData, &item) < 0)
-                return -1;
+                goto cleanup;
         }
     }
 
-- 
2.20.1




More information about the libvir-list mailing list