From: Lennart Poettering Date: Thu, 25 Oct 2018 11:57:32 +0000 (+0200) Subject: tmpfiles: use free_and_replace() where appropriate X-Git-Tag: v240~265^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81fa4479f8bb469959c93f7aa15c9331d9683240;p=thirdparty%2Fsystemd.git tmpfiles: use free_and_replace() where appropriate --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index b1e85e22329..67060e57c11 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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, "-")) {