Commit c969fb1d authored by Michael Biebl's avatar Michael Biebl

systemctl: fix segfault in enable_unit()

This bug was introduced in aa57b6c5

We need to initialize the DBusError struct before it is used/freed.
parent 15199d3e
......@@ -4244,6 +4244,8 @@ static int enable_unit(DBusConnection *bus, char **args) {
_cleanup_dbus_error_free_ DBusError error;
_cleanup_strv_free_ char **mangled_names = NULL;
dbus_error_init(&error);
if (!args[1])
return 0;
......@@ -4258,8 +4260,6 @@ static int enable_unit(DBusConnection *bus, char **args) {
if (!args[1])
return 0;
dbus_error_init(&error);
if (!bus || avoid_bus()) {
if (streq(verb, "enable")) {
r = unit_file_enable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment