diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-09-23 01:44:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-09-23 01:45:34 +0200 |
commit | f8440af5febb18ddfd2bc7a94b771284f0b7b310 (patch) | |
tree | 83172e88ffe4251d3fe7765a1f5874e1a5135f1a /src/systemctl.c | |
parent | 8ea913b2eaadbd92e069ea6b71cc5f5df409decf (diff) |
coverity: change a few things so that coverity doesn't show so many false positives
Diffstat (limited to 'src/systemctl.c')
-rw-r--r-- | src/systemctl.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/systemctl.c b/src/systemctl.c index e85a2fd44c..fdff2d1250 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -137,6 +137,8 @@ static bool on_tty(void) { } static void pager_open_if_enabled(void) { + + /* Cache result before we open the pager */ on_tty(); if (arg_no_pager) @@ -1055,7 +1057,7 @@ finish: } static int load_unit(DBusConnection *bus, char **args) { - DBusMessage *m = NULL, *reply = NULL; + DBusMessage *m = NULL; DBusError error; int r; char **name; @@ -1066,6 +1068,7 @@ static int load_unit(DBusConnection *bus, char **args) { assert(args); STRV_FOREACH(name, args+1) { + DBusMessage *reply; if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", @@ -1103,9 +1106,6 @@ finish: if (m) dbus_message_unref(m); - if (reply) - dbus_message_unref(reply); - dbus_error_free(&error); return r; @@ -1795,7 +1795,7 @@ finish: } static int kill_unit(DBusConnection *bus, char **args) { - DBusMessage *m = NULL, *reply = NULL; + DBusMessage *m = NULL; int r = 0; DBusError error; char **name; @@ -1812,6 +1812,7 @@ static int kill_unit(DBusConnection *bus, char **args) { arg_kill_mode = streq(arg_kill_who, "all") ? "control-group" : "process"; STRV_FOREACH(name, args+1) { + DBusMessage *reply; if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", @@ -1851,9 +1852,6 @@ finish: if (m) dbus_message_unref(m); - if (reply) - dbus_message_unref(reply); - dbus_error_free(&error); return r; @@ -3231,7 +3229,7 @@ finish: } static int reset_failed(DBusConnection *bus, char **args) { - DBusMessage *m = NULL, *reply = NULL; + DBusMessage *m = NULL; int r; DBusError error; char **name; @@ -3243,6 +3241,7 @@ static int reset_failed(DBusConnection *bus, char **args) { return daemon_reload(bus, args); STRV_FOREACH(name, args+1) { + DBusMessage *reply; if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", @@ -3279,9 +3278,6 @@ finish: if (m) dbus_message_unref(m); - if (reply) - dbus_message_unref(reply); - dbus_error_free(&error); return r; |