diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-07-12 08:15:21 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-07-12 13:24:06 -0400 |
commit | d7b478b448d16b0f755e7e1c2eb4df83859034b2 (patch) | |
tree | d9d8076fd845bcf75d136d0303ca1a8019680754 /src | |
parent | b463b81399f0bc0d54107ef819cc0f843473c7d7 (diff) |
shared/install: fix trivial memleak
We lost the reference when setting path second time.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/install.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index d2dd276803..eb9a5fc0b5 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -506,7 +506,7 @@ static int find_symlinks_in_scope( UnitFileState *state) { int r; - _cleanup_free_ char *path = NULL; + _cleanup_free_ char *path2 = NULL; bool same_name_link_runtime = false, same_name_link = false; assert(scope >= 0); @@ -514,6 +514,7 @@ static int find_symlinks_in_scope( assert(name); if (scope == UNIT_FILE_SYSTEM || scope == UNIT_FILE_GLOBAL) { + _cleanup_free_ char *path = NULL; /* First look in runtime config path */ r = get_config_path(scope, true, root_dir, &path); @@ -530,11 +531,11 @@ static int find_symlinks_in_scope( } /* Then look in the normal config path */ - r = get_config_path(scope, false, root_dir, &path); + r = get_config_path(scope, false, root_dir, &path2); if (r < 0) return r; - r = find_symlinks(name, path, &same_name_link); + r = find_symlinks(name, path2, &same_name_link); if (r < 0) return r; else if (r > 0) { |