Skip to content

Commit

Permalink
path-util: fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
poettering committed Feb 11, 2013
1 parent f74e605 commit 91a6489
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/shared/path-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -190,7 +191,6 @@ char **path_strv_canonicalize(char **l) {

errno = 0;
u = canonicalize_file_name(t);

if (!u) {
if (errno == ENOENT)
u = t;
Expand All @@ -201,7 +201,8 @@ char **path_strv_canonicalize(char **l) {

continue;
}
}
} else
free(t);

l[k++] = u;
}
Expand Down

0 comments on commit 91a6489

Please sign in to comment.