summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-02-16 14:23:53 -0800
committerAndreas Schneider <asn@cryptomilk.org>2016-02-18 01:42:50 +0100
commit833a2f474367624dd9980abb28227850e95fe976 (patch)
tree7c165d29426536f9dec1580143863799df0e6721 /lib/tevent
parent03081c2c1484504bdcc0e111b2df95e073c1c166 (diff)
downloadsamba-833a2f474367624dd9980abb28227850e95fe976.tar.gz
lib: tevent: Fix memory leak reported by Pavel Březina <pbrezina@redhat.com> when old signal action restored.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11742 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Feb 18 01:42:50 CET 2016 on sn-devel-144
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent_signal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 924dc05c029..9bc11edca42 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -212,6 +212,7 @@ static int tevent_signal_destructor(struct tevent_signal *se)
/* 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;
}
#ifdef SA_SIGINFO
@@ -342,6 +343,8 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
return NULL;
}
if (sigaction(signum, &act, sig_state->oldact[signum]) == -1) {
+ talloc_free(sig_state->oldact[signum]);
+ sig_state->oldact[signum] = NULL;
talloc_free(se);
return NULL;
}
@@ -505,6 +508,7 @@ void tevent_cleanup_pending_signal_handlers(struct tevent_signal *se)
if (sig_state->sig_handlers[se->signum] == NULL) {
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;
}
}