|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
From 7b0a1d188bf80e77d833f1c624a9a9f467f3af25 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
From: Ronny Chevalier <chevalier.ronny@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
Date: Fri, 10 Apr 2015 15:44:02 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
Subject: [PATCH] shared: fix memleak
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
path was used for 2 purposes but it was not freed before being reused.
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
(cherry picked from commit 0d67448869bd881fd6aea57de6da98800395cf1f)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
src/shared/install.c | 10 +++++-----
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
diff --git a/src/shared/install.c b/src/shared/install.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
index 92b8d6e8ef..efd489ec08 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
--- a/src/shared/install.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+++ b/src/shared/install.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
@@ -515,7 +515,7 @@ static int find_symlinks_in_scope(
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
UnitFileState *state) {
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
int r;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- _cleanup_free_ char *path = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ _cleanup_free_ char *normal_path = NULL, *runtime_path = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
bool same_name_link_runtime = false, same_name_link = false;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
assert(scope >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
@@ -523,11 +523,11 @@ static int find_symlinks_in_scope(
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
assert(name);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
/* First look in runtime config path */
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- r = get_config_path(scope, true, root_dir, &path);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ r = get_config_path(scope, true, root_dir, &normal_path);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- r = find_symlinks(name, path, &same_name_link_runtime);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ r = find_symlinks(name, normal_path, &same_name_link_runtime);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
else if (r > 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
@@ -536,11 +536,11 @@ static int find_symlinks_in_scope(
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
/* Then look in the normal config path */
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- r = get_config_path(scope, false, root_dir, &path);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ r = get_config_path(scope, false, root_dir, &runtime_path);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- r = find_symlinks(name, path, &same_name_link);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ r = find_symlinks(name, runtime_path, &same_name_link);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
else if (r > 0) {
|