]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: use g_clear_pointer
authorJán Tomko <jtomko@redhat.com>
Tue, 10 Aug 2021 15:09:30 +0000 (17:09 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 11 Aug 2021 08:52:58 +0000 (10:52 +0200)
Replace remaining uses of VIR_FREE with g_clear_pointer.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tools/vsh.c

index f55eb083f5a3e8286a344f410c2733f7a279299e..f9600bafba719c212184ac1f76993b76b79f0410 100644 (file)
@@ -2253,10 +2253,7 @@ vshCloseLogFile(vshControl *ctl)
                  g_strerror(errno));
     }
 
-    if (ctl->logfile) {
-        VIR_FREE(ctl->logfile);
-        ctl->logfile = NULL;
-    }
+    g_clear_pointer(&ctl->logfile, g_free);
 }
 
 #ifndef WIN32
@@ -2852,8 +2849,8 @@ vshReadlineDeinit(vshControl *ctl)
         }
     }
 
-    VIR_FREE(ctl->historydir);
-    VIR_FREE(ctl->historyfile);
+    g_clear_pointer(&ctl->historydir, g_free);
+    g_clear_pointer(&ctl->historyfile, g_free);
 }
 
 char *