Re: [libvirt] [PATCH] parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities
On 06/09/14 09:43, Martin Kletzander wrote: > On Mon, Jun 09, 2014 at 09:39:44AM +0200, Peter Krempa wrote: >> 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. >> --- >> src/parallels/parallels_driver.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> > > ACK, > > Martin > Pushed; Thanks. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities
On Mon, Jun 09, 2014 at 09:39:44AM +0200, Peter Krempa wrote: 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. --- src/parallels/parallels_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ACK, Martin diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 153961b..411527c 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; -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] 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. --- src/parallels/parallels_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 153961b..411527c 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; -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list