[PATCH 01/30] util: convert pointers to use g_autofree

Ryan Gahagan rgahagan at cs.utexas.edu
Mon Nov 23 22:09:22 UTC 2020


From: Barrett Schonefeld <bschoney at utexas.edu>

- src/util/virxml.c

Signed-off-by: Barrett Schonefeld <bschoney at utexas.edu>
---
 src/util/virxml.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/util/virxml.c b/src/util/virxml.c
index a3b819d85c..7df50e4b4d 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -696,8 +696,8 @@ catchXMLError(void *ctx, const char *msg G_GNUC_UNUSED, ...)
     unsigned int n, col;        /* GCC warns if signed, because compared with sizeof() */
     int domcode = VIR_FROM_XML;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    char *contextstr = NULL;
-    char *pointerstr = NULL;
+    g_autofree char *contextstr = NULL;
+    g_autofree char *pointerstr = NULL;
 
 
     /* conditions for error printing */
@@ -763,9 +763,6 @@ catchXMLError(void *ctx, const char *msg G_GNUC_UNUSED, ...)
                               contextstr,
                               pointerstr);
     }
-
-    VIR_FREE(contextstr);
-    VIR_FREE(pointerstr);
 }
 
 /**
-- 
2.29.0




More information about the libvir-list mailing list