[PATCH 03/42] rpc: Use g_autofree on virNetClientNewLibSSH2()

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

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 src/rpc/virnetclient.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 47a17d30f7..75e653fec8 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -442,13 +442,13 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
     virNetClientPtr ret = NULL;
 
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    char *nc = NULL;
-    char *command = NULL;
+    g_autofree char *nc = NULL;
+    g_autofree char *command = NULL;
 
-    char *homedir = NULL;
-    char *confdir = NULL;
-    char *knownhosts = NULL;
-    char *privkey = NULL;
+    g_autofree char *homedir = NULL;
+    g_autofree char *confdir = NULL;
+    g_autofree char *knownhosts = NULL;
+    g_autofree char *privkey = NULL;
 
     /* Use default paths for known hosts an public keys if not provided */
     if (knownHostsPath) {
@@ -517,12 +517,6 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
         goto cleanup;
 
  cleanup:
-    VIR_FREE(command);
-    VIR_FREE(privkey);
-    VIR_FREE(knownhosts);
-    VIR_FREE(homedir);
-    VIR_FREE(confdir);
-    VIR_FREE(nc);
     return ret;
 
  no_memory:
-- 
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