From 088ab19554808d7c5cfeec50f1cb61a8924b5b62 Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Fri, 1 Aug 2014 15:58:20 -0700 Subject: [PATCH] bugfix: segmentation fault might happen in ngx_destroy_pool when debug logging was enabled in the nginx build. thanks buddy-ekb for the report in #21. --- src/ngx_postgres_keepalive.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ngx_postgres_keepalive.c b/src/ngx_postgres_keepalive.c index 9f10749b..b6bac30f 100644 --- a/src/ngx_postgres_keepalive.c +++ b/src/ngx_postgres_keepalive.c @@ -85,6 +85,9 @@ ngx_postgres_keepalive_get_peer_single(ngx_peer_connection_t *pc, c->idle = 0; c->log = pc->log; +#if defined(nginx_version) && (nginx_version >= 1001004) + c->pool->log = pc->log; +#endif c->read->log = pc->log; c->write->log = pc->log; @@ -140,6 +143,9 @@ ngx_postgres_keepalive_get_peer_multi(ngx_peer_connection_t *pc, c->idle = 0; c->log = pc->log; +#if defined(nginx_version) && (nginx_version >= 1001004) + c->pool->log = pc->log; +#endif c->read->log = pc->log; c->write->log = pc->log; @@ -235,6 +241,9 @@ ngx_postgres_keepalive_free_peer(ngx_peer_connection_t *pc, c->data = item; c->idle = 1; c->log = ngx_cycle->log; +#if defined(nginx_version) && (nginx_version >= 1001004) + c->pool->log = ngx_cycle->log; +#endif c->read->log = ngx_cycle->log; c->write->log = ngx_cycle->log;