mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities
4d06af97d3
introduced a possible memory
leak of the memory allocated into the "cpu" pointer in
parallelsBuildCapabilities in the case "nodeGetInfo()" would fail right
after the allocation. Rearrange the code to avoid the possibility of the
leak.
Found by Coverity.
This commit is contained in:
parent
df01390afc
commit
20d0c33aee
@ -151,10 +151,10 @@ parallelsBuildCapabilities(void)
|
|||||||
"parallels", NULL, NULL, 0, NULL) == NULL)
|
"parallels", NULL, NULL, 0, NULL) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_ALLOC(cpu) < 0)
|
if (nodeGetInfo(&nodeinfo))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (nodeGetInfo(&nodeinfo))
|
if (VIR_ALLOC(cpu) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cpu->arch = caps->host.arch;
|
cpu->arch = caps->host.arch;
|
||||||
|
Loading…
Reference in New Issue
Block a user