fix max size allocated from pool
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index 971887f..5a0ea51 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -26,8 +26,9 @@
     p->d.end = (u_char *) p + size;
     p->d.next = NULL;
 
-    p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size - sizeof(ngx_pool_t):
-                                                NGX_MAX_ALLOC_FROM_POOL;
+    size = size - sizeof(ngx_pool_t);
+    p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
+
     p->current = p;
     p->chain = NULL;
     p->large = NULL;