Skip to content

Commit

Permalink
tevent_poll: Avoid a crash in poll_event_set_fd_flags
Browse files Browse the repository at this point in the history
The event context might have been freed before the fde

Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
vlendec authored and jrasamba committed Feb 3, 2013
1 parent 611fcca commit 1cfc76f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/tevent/tevent_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1cfc76f

Please sign in to comment.