path-util: make use of TAKE_PTR() where we can
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Jul 2020 17:09:48 +0000 (19:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 30 Jul 2020 14:42:58 +0000 (16:42 +0200)
src/basic/path-util.c

index 986dfe9..c4e022b 100644 (file)
@@ -640,10 +640,8 @@ int find_binary(const char *name, char **ret) {
                 if (access(j, X_OK) >= 0) {
                         /* Found it! */
 
-                        if (ret) {
-                                *ret = path_simplify(j, false);
-                                j = NULL;
-                        }
+                        if (ret)
+                                *ret = path_simplify(TAKE_PTR(j), false);
 
                         return 0;
                 }