]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: use free_and_replace() where appropriate
authorLennart Poettering <lennart@poettering.net>
Thu, 25 Oct 2018 11:57:32 +0000 (13:57 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 8 Nov 2018 08:52:16 +0000 (09:52 +0100)
src/tmpfiles/tmpfiles.c

index b1e85e223298f9ce5eb72080bc9a0eaa8f0a9a6d..67060e57c113fc88d5439db540735f0f88c6d292 100644 (file)
@@ -2471,8 +2471,7 @@ static int patch_var_run(const char *fname, unsigned line, char **path) {
 
         log_notice("[%s:%u] Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.", fname, line, *path, n);
 
-        free(*path);
-        *path = n;
+        free_and_replace(*path, n);
 
         return 0;
 }
@@ -2709,8 +2708,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
                 if (!p)
                         return log_oom();
 
-                free(i.path);
-                i.path = p;
+                free_and_replace(i.path, p);
         }
 
         if (!isempty(user) && !streq(user, "-")) {