diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-04-05 07:26:26 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-04-05 07:26:26 +0200 |
commit | 1cc6c93a9569a9f2664d0d26cd0e50408307c430 (patch) | |
tree | 57e115a1beb9b097f731da79c3192015ff35cc94 /src/core/load-fragment.c | |
parent | network: fix typo in log message (diff) | |
download | systemd-1cc6c93a9569a9f2664d0d26cd0e50408307c430.tar.xz systemd-1cc6c93a9569a9f2664d0d26cd0e50408307c430.zip |
tree-wide: use TAKE_PTR() and TAKE_FD() macros
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 887eb1cf49..be4af94fc8 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -731,9 +731,9 @@ int config_parse_exec( if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) return log_oom(); - n[nlen++] = resolved; + + n[nlen++] = TAKE_PTR(resolved); n[nlen] = NULL; - resolved = NULL; } if (!n || !n[0]) { @@ -747,15 +747,13 @@ int config_parse_exec( if (!nce) return log_oom(); - nce->argv = n; - nce->path = path; + nce->argv = TAKE_PTR(n); + nce->path = TAKE_PTR(path); nce->flags = flags; exec_command_append_list(e, nce); /* Do not _cleanup_free_ these. */ - n = NULL; - path = NULL; nce = NULL; rvalue = p; @@ -2397,9 +2395,8 @@ int config_parse_pass_environ( if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) return log_oom(); - n[nlen++] = k; + n[nlen++] = TAKE_PTR(k); n[nlen] = NULL; - k = NULL; } if (n) { @@ -2474,9 +2471,8 @@ int config_parse_unset_environ( if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) return log_oom(); - n[nlen++] = k; + n[nlen++] = TAKE_PTR(k); n[nlen] = NULL; - k = NULL; } if (n) { @@ -4762,9 +4758,7 @@ static int load_from_path(Unit *u, const char *path) { return r; } - free(u->fragment_path); - u->fragment_path = filename; - filename = NULL; + free_and_replace(u->fragment_path, filename); if (u->source_path) { if (stat(u->source_path, &st) >= 0) |