]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Fix memory leak - virCPUx86GetHost
authorJohn Ferlan <jferlan@redhat.com>
Fri, 21 Jun 2019 17:07:15 +0000 (13:07 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 24 Jun 2019 21:46:28 +0000 (17:46 -0400)
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>
src/cpu/cpu_x86.c

index 71fc365139b87f42bbc46a0d184da6c96f71a579..978a60c90a6fdf5a87f5db3d394041c04905f445 100644 (file)
@@ -2791,7 +2791,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
             };
 
             if (virCPUx86DataAdd(cpuData, &item) < 0)
-                return -1;
+                goto cleanup;
         }
     }