From: Michal Privoznik Date: Wed, 20 Feb 2019 13:12:09 +0000 (+0100) Subject: virTestCompareToULL: Use VIR_AUTOFREE() X-Git-Tag: v5.1.0-rc1~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86d1f08669225dcd565d291d9a952dab95d681b6;p=thirdparty%2Flibvirt.git virTestCompareToULL: Use VIR_AUTOFREE() In order to save a few lines of code, and also since it's hype let's use VIR_AUTOFREE() for the two strings we allocate there. Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani Reviewed-by: Ján Tomko --- diff --git a/tests/testutils.c b/tests/testutils.c index d2219ad21e..ac86418653 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -822,23 +822,16 @@ int virTestCompareToULL(unsigned long long content, unsigned long long src) { - char *strcontent = NULL; - char *strsrc = NULL; - int ret = -1; + VIR_AUTOFREE(char *) strcontent = NULL; + VIR_AUTOFREE(char *) strsrc = NULL; if (virAsprintf(&strcontent, "%llu", content) < 0) - goto cleanup; + return -1; if (virAsprintf(&strsrc, "%llu", src) < 0) - goto cleanup; - - ret = virTestCompareToString(strcontent, strsrc); - - cleanup: - VIR_FREE(strcontent); - VIR_FREE(strsrc); + return -1; - return ret; + return virTestCompareToString(strcontent, strsrc); } /*