From: Stefan Berger Date: Fri, 26 Jul 2019 20:56:31 +0000 (-0400) Subject: tests: Call virCommandFree() in cleanup section X-Git-Tag: v5.6.0-rc1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b4bc79549dc0e56dadedbf5a244e09fa598a2f2;p=thirdparty%2Flibvirt.git tests: Call virCommandFree() in cleanup section Fix a potential memory leak by calling virCommandFree() in the cleanup section. Signed-off-by: Stefan Berger Reviewed-by: John Ferlan Message-Id: <20190726205633.2041912-3-stefanb@linux.vnet.ibm.com> --- diff --git a/tests/commandtest.c b/tests/commandtest.c index 991c0572b0..dfd15a2079 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -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]);