From: Peter Krempa Date: Mon, 5 Oct 2020 09:28:14 +0000 (+0200) Subject: virbitmaptest: Use separate output strings in 'test5' X-Git-Tag: v6.9.0-rc1~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1bc02be90ad42deef39b5ce1351c7e4f30f85f;p=thirdparty%2Flibvirt.git virbitmaptest: Use separate output strings in 'test5' The test validates two outputs. Don't reuse 'str' for both. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 98ac06c406..dc23431645 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -329,7 +329,8 @@ test5(const void *v G_GNUC_UNUSED) size_t i; ssize_t j; int ret = -1; - char *str = NULL; + g_autofree char *actual1 = NULL; + g_autofree char *actual2 = NULL; bitmap = virBitmapNewData(data, sizeof(data)); if (!bitmap) @@ -359,19 +360,17 @@ test5(const void *v G_GNUC_UNUSED) data2[4] != 0x04) goto error; - if (!(str = virBitmapDataFormat(data, sizeof(data)))) + if (!(actual1 = virBitmapDataFormat(data, sizeof(data)))) goto error; - if (STRNEQ(str, "0,9,34")) + if (STRNEQ(actual1, "0,9,34")) goto error; - VIR_FREE(str); - if (!(str = virBitmapDataFormat(data2, len2))) + if (!(actual2 = virBitmapDataFormat(data2, len2))) goto error; - if (STRNEQ(str, "0,2,9,15,34")) + if (STRNEQ(actual2, "0,2,9,15,34")) goto error; ret = 0; error: - VIR_FREE(str); virBitmapFree(bitmap); VIR_FREE(data2); return ret;