]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
path-util: use _cleanup_
authorDavid Tardon <dtardon@redhat.com>
Fri, 21 Apr 2023 12:44:06 +0000 (14:44 +0200)
committerDavid Tardon <dtardon@redhat.com>
Thu, 27 Apr 2023 19:42:38 +0000 (21:42 +0200)
src/basic/path-util.c

index 0b0f0da7602675b5e33797c09dc1f403413442a7..a68106556568e5ed9692b2e30f1488a8105e9810 100644 (file)
@@ -22,7 +22,7 @@
 #include "time-util.h"
 
 int path_split_and_make_absolute(const char *p, char ***ret) {
-        char **l;
+        _cleanup_strv_free_ char **l = NULL;
         int r;
 
         assert(p);
@@ -33,12 +33,10 @@ int path_split_and_make_absolute(const char *p, char ***ret) {
                 return -ENOMEM;
 
         r = path_strv_make_absolute_cwd(l);
-        if (r < 0) {
-                strv_free(l);
+        if (r < 0)
                 return r;
-        }
 
-        *ret = l;
+        *ret = TAKE_PTR(l);
         return r;
 }