From 8b565bf40b6a64ade389b113edc5cc1d8ee8015d Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Tue, 6 Jul 2021 13:38:05 +0200 Subject: [PATCH] virSystemdActivationNew: Use automatic memory management Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- 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; }