]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homed-manager-bus: use _cleanup_
authorDavid Tardon <dtardon@redhat.com>
Fri, 21 Apr 2023 13:30:45 +0000 (15:30 +0200)
committerDavid Tardon <dtardon@redhat.com>
Fri, 28 Apr 2023 07:29:03 +0000 (09:29 +0200)
src/home/homed-manager-bus.c

index 0c0c292a70f7debe96ba44a4d3efee92ee06addf..ca639ae39e87341965ff6ff11d7b57477c7b0d0c 100644 (file)
@@ -385,7 +385,7 @@ static int method_register_home(
 
         _cleanup_(user_record_unrefp) UserRecord *hr = NULL;
         Manager *m = ASSERT_PTR(userdata);
-        Home *h;
+        _cleanup_(home_freep) Home *h = NULL;
         int r;
 
         assert(message);
@@ -413,10 +413,10 @@ static int method_register_home(
                 return r;
 
         r = home_save_record(h);
-        if (r < 0) {
-                home_free(h);
+        if (r < 0)
                 return r;
-        }
+
+        TAKE_PTR(h);
 
         return sd_bus_reply_method_return(message, NULL);
 }