summaryrefslogtreecommitdiff
path: root/src/login/logind.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2015-08-17 10:45:30 +0200
committerMarkus Elfring <elfring@users.sourceforge.net>2015-08-17 10:45:30 +0200
commit3e044c492e3ebe64f4e3175c94f9db8a62557b82 (patch)
tree162e76658ef1e646546eca079d08e0143c4747b6 /src/login/logind.c
parentdc4ebc0787a299f064553e6d28a7f35574ce1c2a (diff)
Bug #944: Deletion of unnecessary checks before a few calls of systemd functions
The following functions return immediately if a null pointer was passed. * calendar_spec_free * link_address_free * manager_free * sd_bus_unref * sd_journal_close * udev_monitor_unref * udev_unref It is therefore not needed that a function caller repeats a corresponding check. This issue was fixed by using the software Coccinelle 1.0.1.
Diffstat (limited to 'src/login/logind.c')
-rw-r--r--src/login/logind.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index cf71c0ec5a..8ac2aceb9b 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -153,17 +153,12 @@ static void manager_free(Manager *m) {
safe_close(m->console_active_fd);
- if (m->udev_seat_monitor)
- udev_monitor_unref(m->udev_seat_monitor);
- if (m->udev_device_monitor)
- udev_monitor_unref(m->udev_device_monitor);
- if (m->udev_vcsa_monitor)
- udev_monitor_unref(m->udev_vcsa_monitor);
- if (m->udev_button_monitor)
- udev_monitor_unref(m->udev_button_monitor);
-
- if (m->udev)
- udev_unref(m->udev);
+ udev_monitor_unref(m->udev_seat_monitor);
+ udev_monitor_unref(m->udev_device_monitor);
+ udev_monitor_unref(m->udev_vcsa_monitor);
+ udev_monitor_unref(m->udev_button_monitor);
+
+ udev_unref(m->udev);
if (m->unlink_nologin)
(void) unlink("/run/nologin");
@@ -1170,8 +1165,7 @@ finish:
"STOPPING=1\n"
"STATUS=Shutting down...");
- if (m)
- manager_free(m);
+ manager_free(m);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}