chiark / gitweb /
systemctl: fix resource leak CID #1237747
[elogind.git] / src / systemctl / systemctl.c
index 88be871f326eb16750ec085819caafcd68ae3999..901212852d9b22ef864dec8ccc50cdded9381ac2 100644 (file)
@@ -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);