[PATCH 01/42] tools: Use g_autofree on cmdCd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tools/vsh.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 5ccda5ab44..bbb6227130 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3175,8 +3175,7 @@ bool
 cmdCd(vshControl *ctl, const vshCmd *cmd)
 {
     const char *dir = NULL;
-    char *dir_malloced = NULL;
-    bool ret = true;
+    g_autofree char *dir_malloced = NULL;
     char ebuf[1024];
 
     if (!ctl->imode) {
@@ -3192,11 +3191,10 @@ cmdCd(vshControl *ctl, const vshCmd *cmd)
     if (chdir(dir) == -1) {
         vshError(ctl, _("cd: %s: %s"),
                  virStrerror(errno, ebuf, sizeof(ebuf)), dir);
-        ret = false;
+        return false;
     }
 
-    VIR_FREE(dir_malloced);
-    return ret;
+    return true;
 }
 
 const vshCmdOptDef opts_echo[] = {
-- 
2.24.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux