mirror of
https://github.com/nginx/nginx.git
synced 2024-12-11 09:49:02 +08:00
Resolver: fixed use-after-free memory access.
In 954867a2f0a6, we switched to using resolver node as the timer event data, so make sure we do not free resolver node memory until the corresponding timer is deleted.
This commit is contained in:
parent
96a62f1396
commit
d4b7b74686
@ -1568,8 +1568,6 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
|
||||
ngx_rbtree_delete(&r->name_rbtree, &rn->node);
|
||||
|
||||
ngx_resolver_free_node(r, rn);
|
||||
|
||||
/* unlock name mutex */
|
||||
|
||||
while (next) {
|
||||
@ -1580,6 +1578,8 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
ctx->handler(ctx);
|
||||
}
|
||||
|
||||
ngx_resolver_free_node(r, rn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2143,8 +2143,6 @@ valid:
|
||||
|
||||
ngx_rbtree_delete(tree, &rn->node);
|
||||
|
||||
ngx_resolver_free_node(r, rn);
|
||||
|
||||
/* unlock addr mutex */
|
||||
|
||||
while (next) {
|
||||
@ -2155,6 +2153,8 @@ valid:
|
||||
ctx->handler(ctx);
|
||||
}
|
||||
|
||||
ngx_resolver_free_node(r, rn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user