]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
initctl: use _cleanup_
authorDavid Tardon <dtardon@redhat.com>
Fri, 21 Apr 2023 13:34:11 +0000 (15:34 +0200)
committerDavid Tardon <dtardon@redhat.com>
Thu, 27 Apr 2023 19:42:38 +0000 (21:42 +0200)
src/initctl/initctl.c

index b7fd215acd930e57fbea8afb289efa6c14777371..d1b7c305624fb2e857d6e0bb029f5af6e373332f 100644 (file)
@@ -284,7 +284,7 @@ static int server_init(Server *s, unsigned n_sockets) {
 
 static int process_event(Server *s, struct epoll_event *ev) {
         int r;
-        Fifo *f;
+        _cleanup_(fifo_freep) Fifo *f = NULL;
 
         assert(s);
         assert(ev);
@@ -295,11 +295,10 @@ static int process_event(Server *s, struct epoll_event *ev) {
 
         f = (Fifo*) ev->data.ptr;
         r = fifo_process(f);
-        if (r < 0) {
-                log_info_errno(r, "Got error on fifo: %m");
-                fifo_free(f);
-                return r;
-        }
+        if (r < 0)
+                return log_info_errno(r, "Got error on fifo: %m");
+
+        TAKE_PTR(f);
 
         return 0;
 }