Skip to content

Commit

Permalink
Stream: fixed possible use of a freed connection.
Browse files Browse the repository at this point in the history
The session handler may result in session termination, thus a connection
pool (from which c->udp was allocated) may be destroyed.
  • Loading branch information
vlhomutov committed Nov 7, 2018
1 parent 6351d83 commit 7e3041b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/event/ngx_event_udp.c
Expand Up @@ -261,7 +261,10 @@ ngx_event_recvmsg(ngx_event_t *ev)

rev->handler(rev);

c->udp->buffer = NULL;
if (c->udp) {
c->udp->buffer = NULL;
}

rev->ready = 0;

goto next;
Expand Down Expand Up @@ -561,6 +564,8 @@ ngx_delete_udp_connection(void *data)
ngx_connection_t *c = data;

ngx_rbtree_delete(&c->listening->rbtree, &c->udp->node);

c->udp = NULL;
}


Expand Down

0 comments on commit 7e3041b

Please sign in to comment.