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:
Stefan Berger 2019-07-26 16:56:31 -04:00 committed by Eric Blake
parent b8358f94e0
commit 9b4bc79549

View File

@ -1219,8 +1219,6 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
goto cleanup;
}
virCommandFree(cmd);
if (!outactual || !erractual)
goto cleanup;
@ -1236,6 +1234,7 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
ret = 0;
cleanup:
virCommandFree(cmd);
VIR_FORCE_CLOSE(pipe1[0]);
VIR_FORCE_CLOSE(pipe2[0]);
VIR_FORCE_CLOSE(pipe1[1]);