From: Peter Krempa Date: Mon, 9 Jun 2014 07:36:30 +0000 (+0200) Subject: parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=20d0c33aee34ea2bf36b1a2b648474e101ca1126;p=libvirt.git parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities 4d06af97d38c3648937eb8f732704379b3cd9e59 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. --- diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 153961b389..411527c03f 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -151,10 +151,10 @@ parallelsBuildCapabilities(void) "parallels", NULL, NULL, 0, NULL) == NULL) goto error; - if (VIR_ALLOC(cpu) < 0) + if (nodeGetInfo(&nodeinfo)) goto error; - if (nodeGetInfo(&nodeinfo)) + if (VIR_ALLOC(cpu) < 0) goto error; cpu->arch = caps->host.arch;