chiark / gitweb /
use more _cleanup_ macro
[elogind.git] / src / core / killall.c
index 57ed41c5afe4d2eb62e3adb20562a65f9de10e24..291e1f90eeb192be472f2faf876a04c4e0521093 100644 (file)
@@ -168,7 +168,7 @@ static int killall(int sig, Set *pids, bool send_sighup) {
                         continue;
 
                 if (sig == SIGKILL) {
-                        _cleanup_free_ char *s;
+                        _cleanup_free_ char *s = NULL;
 
                         get_process_comm(pid, &s);
                         log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
@@ -202,7 +202,7 @@ static int killall(int sig, Set *pids, bool send_sighup) {
 
 void broadcast_signal(int sig, bool wait_for_exit, bool send_sighup) {
         sigset_t mask, oldmask;
-        Set *pids = NULL;
+        _cleanup_set_free_ Set *pids = NULL;
 
         if (wait_for_exit)
                 pids = set_new(trivial_hash_func, trivial_compare_func);
@@ -223,6 +223,4 @@ void broadcast_signal(int sig, bool wait_for_exit, bool send_sighup) {
                 wait_for_children(pids, &mask);
 
         assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) == 0);
-
-        set_free(pids);
 }