summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-01-31 16:34:41 +0100
committerJeremy Allison <jra@samba.org>2013-02-02 19:53:30 -0800
commit1cfc76f72ae454b13dbaeca22df06cb6f78f078f (patch)
tree8cd62a3d976c7bb2285e3778746644be86f9dd8a /lib/tevent
parent611fcca641a22a2a23b26752105af99cf338d6a1 (diff)
downloadsamba-1cfc76f72ae454b13dbaeca22df06cb6f78f078f.tar.gz
samba-1cfc76f72ae454b13dbaeca22df06cb6f78f078f.tar.bz2
samba-1cfc76f72ae454b13dbaeca22df06cb6f78f078f.zip
tevent_poll: Avoid a crash in poll_event_set_fd_flags
The event context might have been freed before the fde Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent_poll.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index f63173744f..7d10665353 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -297,11 +297,17 @@ static struct tevent_fd *poll_event_add_fd(struct tevent_context *ev,
*/
static void poll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
- struct poll_event_context *poll_ev = talloc_get_type_abort(
- fde->event_ctx->additional_data, struct poll_event_context);
+ struct tevent_context *ev = fde->event_ctx;
+ struct poll_event_context *poll_ev;
uint64_t idx = fde->additional_flags;
uint16_t pollflags;
+ if (ev == NULL) {
+ return;
+ }
+ poll_ev = talloc_get_type_abort(
+ ev->additional_data, struct poll_event_context);
+
fde->flags = flags;
if (idx == UINT64_MAX) {