From 10732c0ecccab4e125f879154f2ba1da6dcd4d4e Mon Sep 17 00:00:00 2001 From: Markus Linnala Date: Sun, 8 Mar 2015 14:04:24 +0200 Subject: [PATCH] fix alloc failure handlings ngx_pool_cleanup_add can return NULL --- src/ngx_postgres_module.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ngx_postgres_module.c b/src/ngx_postgres_module.c index 365de007..59ee6d11 100644 --- a/src/ngx_postgres_module.c +++ b/src/ngx_postgres_module.c @@ -284,6 +284,9 @@ ngx_postgres_create_upstream_srv_conf(ngx_conf_t *cf) conf->single = 1; cln = ngx_pool_cleanup_add(cf->pool, 0); + if (cln == NULL) { + return NULL; + } cln->handler = ngx_postgres_keepalive_cleanup; cln->data = conf;