[libvirt PATCH 02/38] virSystemdActivationNew: Use automatic memory management

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/util/virsystemd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 6417dc6ea7..f90c17e767 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -958,11 +958,10 @@ virSystemdActivationNew(virSystemdActivationMap *map,
                         size_t nmap,
                         int nfds)
 {
-    virSystemdActivation *act;
+    g_autoptr(virSystemdActivation) act = g_new0(virSystemdActivation, 1);
     const char *fdnames;
 
     VIR_DEBUG("Activated with %d FDs", nfds);
-    act = g_new0(virSystemdActivation, 1);
 
     act->fds = virHashNew(virSystemdActivationEntryFree);
 
@@ -976,10 +975,9 @@ virSystemdActivationNew(virSystemdActivationMap *map,
     }
 
     VIR_DEBUG("Created activation object for %d FDs", nfds);
-    return act;
+    return g_steal_pointer(&act);
 
  error:
-    virSystemdActivationFree(act);
     return NULL;
 }
 
-- 
2.31.1




[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