summaryrefslogtreecommitdiff
path: root/source4/lib/events
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/events')
-rw-r--r--source4/lib/events/events_signal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/events/events_signal.c b/source4/lib/events/events_signal.c
index 2c18a677b1..9a8ebea6ae 100644
--- a/source4/lib/events/events_signal.c
+++ b/source4/lib/events/events_signal.c
@@ -171,6 +171,11 @@ struct signal_event *common_event_add_signal(struct event_context *ev,
se->private_data = private_data;
se->signum = signum;
se->sa_flags = sa_flags;
+
+ /* Ensure, no matter the destruction order, that we always have a handle on the global sig_state */
+ if (!talloc_reference(se, sig_state)) {
+ return NULL;
+ }
/* only install a signal handler if not already installed */
if (sig_state->sig_handlers[signum] == NULL) {