mirror of
https://github.com/nginx/nginx.git
synced 2025-06-27 09:00:38 +08:00
Core: use ngx_palloc_small() to allocate ngx_pool_large_t.
This structure cannot be allocated as a large block anyway, otherwise that will result in infinite recursion, since each large allocation requires to allocate another ngx_pool_large_t. The room for the structure is guaranteed by the NGX_MIN_POOL_SIZE constant.
This commit is contained in:
parent
21dfe90a4e
commit
9d08bda415
@ -231,7 +231,7 @@ ngx_palloc_large(ngx_pool_t *pool, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
|
large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
|
||||||
if (large == NULL) {
|
if (large == NULL) {
|
||||||
ngx_free(p);
|
ngx_free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -256,7 +256,7 @@ ngx_pmemalign(ngx_pool_t *pool, size_t size, size_t alignment)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
|
large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
|
||||||
if (large == NULL) {
|
if (large == NULL) {
|
||||||
ngx_free(p);
|
ngx_free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user