From: Ján Tomko Date: Tue, 10 Aug 2021 15:09:30 +0000 (+0200) Subject: vsh: use g_clear_pointer X-Git-Tag: v7.7.0-rc1~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6488fd3a2d8dcc11fdb2445fe08094d8c67be6f;p=thirdparty%2Flibvirt.git vsh: use g_clear_pointer Replace remaining uses of VIR_FREE with g_clear_pointer. Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- diff --git a/tools/vsh.c b/tools/vsh.c index f55eb083f5..f9600bafba 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -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 *