|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 48a2900c6612052149a1d0dd88aeacb99b49ce4d Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Wed, 17 Sep 2014 21:56:25 -0300
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] systemctl: fix resource leak CID #1237747
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
..by simply moving the declaration of "unit" into the STRV_FOREACH
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
loop as suggested by Andreas.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/systemctl/systemctl.c | 3 ++-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 88be871f32..901212852d 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4449,7 +4449,6 @@ static int show(sd_bus *bus, char **args) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int cat(sd_bus *bus, char **args) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- _cleanup_free_ char *unit = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_strv_free_ char **names = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char **name;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
bool first = true;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4468,6 +4467,8 @@ static int cat(sd_bus *bus, char **args) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_strv_free_ char **dropin_paths = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_free_ char *fragment_path = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ _cleanup_free_ char *unit = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char **path;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unit = unit_dbus_path_from_name(*name);
|