[PATCH 3/7] cputest: Avoid use of temporary variable in DO_TEST macro

Peter Krempa pkrempa at redhat.com
Thu Jun 11 09:43:35 UTC 2020


Use g_free directly to free the returned pointer from
virTestLogContentAndReset rather than store it in a temp variable.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/cputest.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/cputest.c b/tests/cputest.c
index b66ea7850e..0cf6870574 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -997,10 +997,8 @@ mymain(void)
             flags, result \
         }; \
         char *testLabel; \
-        char *tmp; \
  \
-        tmp = virTestLogContentAndReset(); \
-        VIR_FREE(tmp); \
+        g_free(virTestLogContentAndReset());\
  \
         testLabel = g_strdup_printf("%s(%s): %s", #api, \
                                     virArchToString(arch), name); \
-- 
2.26.2




More information about the libvir-list mailing list