[PATCH] Increase size to sizeof(ngx_pool_t) if need when create pool
Ruslan Ermilov
ru at nginx.com
Tue Dec 12 13:58:45 UTC 2017
Hi,
On Tue, Dec 12, 2017 at 02:39:31AM +0000, 廖统浪 wrote:
> # HG changeset patch
> # User Liao Tonglang <liaotonglang at gmail.com>
> # Date 1512991389 -28800
> # Mon Dec 11 19:23:09 2017 +0800
> # Node ID 77be99f1a4766bf19761dfcf03531242923bd0a2
> # Parent d3235149d17f7745d3ac246a6cdcc81a56698f7b
> Increase size to sizeof(ngx_pool_t) if need when create pool
>
> If size is lesser than sizeof(ngx_pool_t), increase it's size to have enough
> memory to store ngx_pool_t, or a coredump will occur.
>
> diff -r d3235149d17f -r 77be99f1a476 src/core/ngx_palloc.c
> --- a/src/core/ngx_palloc.c Thu Dec 07 17:09:36 2017 +0300
> +++ b/src/core/ngx_palloc.c Mon Dec 11 19:23:09 2017 +0800
> @@ -20,6 +20,10 @@
> {
> ngx_pool_t *p;
>
> + if (size < sizeof(ngx_pool_t)) {
> + size = sizeof(ngx_pool_t);
> + }
> +
> p = ngx_memalign(NGX_POOL_ALIGNMENT, size, log);
> if (p == NULL) {
> return NULL;
As documented in [1], the "size" should be at least NGX_MIN_POOL_SIZE
and a multiple of NGX_POOL_ALIGNMENT.
[1] http://nginx.org/en/docs/dev/development_guide.html#pool
Thank you for your patch, but it will not be applied.
More information about the nginx-devel
mailing list