tevent: simplify tevent_signal_destructor()
authorStefan Metzmacher <metze@samba.org>
Tue, 17 Apr 2018 14:43:54 +0000 (16:43 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 11 Jul 2018 21:04:20 +0000 (23:04 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/tevent/tevent_signal.c

index 73b8de798f6936a94551a37318bfb95e4296aadf..ef23024331681fb993eca3493a7aa1667a26bc00 100644 (file)
@@ -184,31 +184,22 @@ static int tevent_common_signal_list_destructor(struct tevent_common_signal_list
 */
 static int tevent_signal_destructor(struct tevent_signal *se)
 {
-       struct tevent_common_signal_list *sl =
-               talloc_get_type_abort(se->additional_data,
-               struct tevent_common_signal_list);
+       TALLOC_FREE(se->additional_data);
 
-       if (se->event_ctx) {
-               struct tevent_context *ev = se->event_ctx;
-
-               DLIST_REMOVE(ev->signal_events, se);
+       if (se->event_ctx != NULL) {
+               DLIST_REMOVE(se->event_ctx->signal_events, se);
        }
 
-       se->additional_data = NULL;
-       talloc_free(sl);
-
        if (sig_state->sig_handlers[se->signum] == NULL) {
                /* restore old handler, if any */
                if (sig_state->oldact[se->signum]) {
                        sigaction(se->signum, sig_state->oldact[se->signum], NULL);
-                       talloc_free(sig_state->oldact[se->signum]);
-                       sig_state->oldact[se->signum] = NULL;
+                       TALLOC_FREE(sig_state->oldact[se->signum]);
                }
 #ifdef SA_SIGINFO
                if (se->sa_flags & SA_SIGINFO) {
                        if (sig_state->sig_info[se->signum]) {
-                               talloc_free(sig_state->sig_info[se->signum]);
-                               sig_state->sig_info[se->signum] = NULL;
+                               TALLOC_FREE(sig_state->sig_info[se->signum]);
                        }
                }
 #endif