From 8bacdde9d538b4636a303982ecddf55c6f39ff9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Sun, 9 Feb 2020 02:07:19 +0100 Subject: [PATCH] virshtest: refactor testCompareOutputLit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use g_autofree and get rid of the cleanup label. Signed-off-by: Ján Tomko Reviewed-by: Daniel P. Berrangé --- tests/virshtest.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/virshtest.c b/tests/virshtest.c index 189238b826..83675710ea 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -60,26 +60,20 @@ static int testCompareOutputLit(const char *expectData, const char *filter, const char *const argv[]) { - int result = -1; - char *actualData = NULL; + g_autofree char *actualData = NULL; if (virTestCaptureProgramOutput(argv, &actualData, 4096) < 0) - goto cleanup; + return -1; if (filter && testFilterLine(actualData, filter) < 0) - goto cleanup; + return -1; if (STRNEQ(expectData, actualData)) { virTestDifference(stderr, expectData, actualData); - goto cleanup; + return -1; } - result = 0; - - cleanup: - VIR_FREE(actualData); - - return result; + return 0; } # define VIRSH_DEFAULT abs_top_builddir "/tools/virsh", \