From: Stefan Metzmacher Date: Tue, 17 Apr 2018 14:43:54 +0000 (+0200) Subject: tevent: simplify tevent_signal_destructor() X-Git-Tag: tevent-0.9.37~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1b347c4ca6fc0640952f1d639c2a321d6feff53;p=thirdparty%2Fsamba.git tevent: simplify tevent_signal_destructor() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index 73b8de798f6..ef230243316 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -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