diff options
author | Cristian RodrÃguez <crrodriguez@opensuse.org> | 2014-09-17 21:56:25 -0300 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2014-09-18 10:16:23 +0200 |
commit | 48a2900c6612052149a1d0dd88aeacb99b49ce4d (patch) | |
tree | 99cba490ca40d71eaecda715f4a994792f259f80 /src/systemctl | |
parent | 4edf33d1e3fb551b1b0cee8e4a2a380c71b00dc7 (diff) |
systemctl: fix resource leak CID #1237747
..by simply moving the declaration of "unit" into the STRV_FOREACH
loop as suggested by Andreas.
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 88be871f32..901212852d 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -4449,7 +4449,6 @@ static int show(sd_bus *bus, char **args) { } static int cat(sd_bus *bus, char **args) { - _cleanup_free_ char *unit = NULL; _cleanup_strv_free_ char **names = NULL; char **name; bool first = true; @@ -4468,6 +4467,8 @@ static int cat(sd_bus *bus, char **args) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_strv_free_ char **dropin_paths = NULL; _cleanup_free_ char *fragment_path = NULL; + _cleanup_free_ char *unit = NULL; + char **path; unit = unit_dbus_path_from_name(*name); |