Stream: fixed possible use of a freed connection.

The session handler may result in session termination, thus a connection
pool (from which c->udp was allocated) may be destroyed.
This commit is contained in:
Vladimir Homutov 2018-11-07 13:22:14 +03:00
parent 6351d8306f
commit 7e3041b79f

View File

@ -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;
@ -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;
}