diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-02-11 05:10:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-02-11 05:10:23 +0100 |
commit | 91a6489d9949776605939fe65a2a6174ee719049 (patch) | |
tree | 5eb23c10e1a1c16a93d09a24bd235b854ba2fb75 /src | |
parent | f74e605fc06c1c23e968dc4c26045eb746791706 (diff) |
path-util: fix memory leak
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/path-util.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c index ae12c05317..52ce65de6d 100644 --- a/src/shared/path-util.c +++ b/src/shared/path-util.c @@ -135,7 +135,8 @@ char *path_make_absolute_cwd(const char *p) { if (path_is_absolute(p)) return strdup(p); - if (!(cwd = get_current_dir_name())) + cwd = get_current_dir_name(); + if (!cwd) return NULL; r = path_make_absolute(p, cwd); @@ -190,7 +191,6 @@ char **path_strv_canonicalize(char **l) { errno = 0; u = canonicalize_file_name(t); - if (!u) { if (errno == ENOENT) u = t; @@ -201,7 +201,8 @@ char **path_strv_canonicalize(char **l) { continue; } - } + } else + free(t); l[k++] = u; } |