From: Ronny Chevalier Date: Fri, 10 Apr 2015 13:44:02 +0000 (+0200) Subject: shared: fix memleak X-Git-Tag: v226.4~1^2~490 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=129b49d8f33ea6efa018392f3d608f2fd9dee60a;hp=c633949d82a8a013bb532125c1e988f6832fc352 shared: fix memleak path was used for 2 purposes but it was not freed before being reused. --- diff --git a/src/shared/install.c b/src/shared/install.c index 1cc999b4d..b121018e9 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -514,7 +514,7 @@ static int find_symlinks_in_scope( UnitFileState *state) { int r; - _cleanup_free_ char *path = NULL; + _cleanup_free_ char *normal_path = NULL, *runtime_path = NULL; bool same_name_link_runtime = false, same_name_link = false; assert(scope >= 0); @@ -522,11 +522,11 @@ static int find_symlinks_in_scope( assert(name); /* First look in runtime config path */ - r = get_config_path(scope, true, root_dir, &path); + r = get_config_path(scope, true, root_dir, &normal_path); if (r < 0) return r; - r = find_symlinks(name, path, &same_name_link_runtime); + r = find_symlinks(name, normal_path, &same_name_link_runtime); if (r < 0) return r; else if (r > 0) { @@ -535,11 +535,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, &runtime_path); if (r < 0) return r; - r = find_symlinks(name, path, &same_name_link); + r = find_symlinks(name, runtime_path, &same_name_link); if (r < 0) return r; else if (r > 0) {