mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: Call virCommandFree() in cleanup section
Fix a potential memory leak by calling virCommandFree() in the cleanup section. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: John Ferlan <jferlan@redhat.com> Message-Id: <20190726205633.2041912-3-stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
b8358f94e0
commit
9b4bc79549
@ -1219,8 +1219,6 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
virCommandFree(cmd);
|
|
||||||
|
|
||||||
if (!outactual || !erractual)
|
if (!outactual || !erractual)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1236,6 +1234,7 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
virCommandFree(cmd);
|
||||||
VIR_FORCE_CLOSE(pipe1[0]);
|
VIR_FORCE_CLOSE(pipe1[0]);
|
||||||
VIR_FORCE_CLOSE(pipe2[0]);
|
VIR_FORCE_CLOSE(pipe2[0]);
|
||||||
VIR_FORCE_CLOSE(pipe1[1]);
|
VIR_FORCE_CLOSE(pipe1[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user