summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-timer.c3
-rw-r--r--src/core/timer.c5
-rw-r--r--src/journal-remote/journal-gatewayd.c3
-rw-r--r--src/journal/journald-server.c3
-rw-r--r--src/libsystemd/sd-bus/test-bus-chat.c4
-rw-r--r--src/login/logind.c20
-rw-r--r--src/machine/machined.c3
-rw-r--r--src/resolve/resolved-manager.c3
-rw-r--r--src/update-utmp/update-utmp.c4
9 files changed, 15 insertions, 33 deletions
diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c
index 74a9914358..8ea2cf84a4 100644
--- a/src/core/dbus-timer.c
+++ b/src/core/dbus-timer.c
@@ -252,8 +252,7 @@ static int bus_timer_set_transient_property(
v = new0(TimerValue, 1);
if (!v) {
- if (c)
- calendar_spec_free(c);
+ calendar_spec_free(c);
return -ENOMEM;
}
diff --git a/src/core/timer.c b/src/core/timer.c
index 51cd56ca84..7027f83dfd 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -56,10 +56,7 @@ void timer_free_values(Timer *t) {
while ((v = t->values)) {
LIST_REMOVE(value, t->values, v);
-
- if (v->calendar_spec)
- calendar_spec_free(v->calendar_spec);
-
+ calendar_spec_free(v->calendar_spec);
free(v);
}
}
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index 1eb07a1681..ebdd9edfc3 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -103,8 +103,7 @@ static void request_meta_free(
if (!m)
return;
- if (m->journal)
- sd_journal_close(m->journal);
+ sd_journal_close(m->journal);
if (m->tmp)
fclose(m->tmp);
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 28b1472ac8..fa2e9b9825 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1689,6 +1689,5 @@ void server_done(Server *s) {
if (s->mmap)
mmap_cache_unref(s->mmap);
- if (s->udev)
- udev_unref(s->udev);
+ udev_unref(s->udev);
}
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index b97729caf7..a0aecc1f55 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -118,9 +118,7 @@ static int server_init(sd_bus **_bus) {
return 0;
fail:
- if (bus)
- sd_bus_unref(bus);
-
+ sd_bus_unref(bus);
return r;
}
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;
}
diff --git a/src/machine/machined.c b/src/machine/machined.c
index 1eeeaf17a5..c8ad157326 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -355,8 +355,7 @@ int main(int argc, char *argv[]) {
log_debug("systemd-machined stopped as pid "PID_FMT, getpid());
finish:
- if (m)
- manager_free(m);
+ manager_free(m);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 5be01d3cb8..645f2a824c 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -176,8 +176,7 @@ static int manager_process_address(sd_netlink *rtnl, sd_netlink_message *mm, voi
break;
case RTM_DELADDR:
- if (a)
- link_address_free(a);
+ link_address_free(a);
break;
}
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index ea9b0c9c84..61bcf02b2f 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -286,8 +286,6 @@ finish:
audit_close(c.audit_fd);
#endif
- if (c.bus)
- sd_bus_unref(c.bus);
-
+ sd_bus_unref(c.bus);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}