[libvirt PATCH v3 4/8] cpu_x86: Use g_auto* in virX86CpuIncompatible

Tim Wiederhake twiederh at redhat.com
Fri Sep 11 13:22:45 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
---
 src/cpu/cpu_x86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index fdb665b01d..db1b2e55a1 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1797,7 +1797,7 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
  */
 #define virX86CpuIncompatible(MSG, CPU_DEF) \
         do { \
-            char *flagsStr = NULL; \
+            g_autofree char *flagsStr = NULL; \
             if (!(flagsStr = x86FeatureNames(map, ", ", (CPU_DEF)))) { \
                 virReportOOMError(); \
                 return VIR_CPU_COMPARE_ERROR; \
@@ -1805,7 +1805,6 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
             if (message) \
                 *message = g_strdup_printf("%s: %s", _(MSG), flagsStr); \
             VIR_DEBUG("%s: %s", MSG, flagsStr); \
-            VIR_FREE(flagsStr); \
         } while (0)
 
 
-- 
2.26.2




More information about the libvir-list mailing list