Skip to content

Commit

Permalink
bugfix: memory leak might happen if nginx 1.1.14+ is used *and* (at l…
Browse files Browse the repository at this point in the history
…east) libpq fails to connect to the remote database.
  • Loading branch information
agentzh committed Jun 21, 2012
1 parent 5c37d2d commit 714081d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ngx_postgres_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define DDEBUG 0
#endif

#include <nginx.h>
#include "ngx_postgres_ddebug.h"
#include "ngx_postgres_module.h"
#include "ngx_postgres_keepalive.h"
Expand Down Expand Up @@ -564,6 +565,12 @@ ngx_postgres_upstream_free_connection(ngx_log_t *log, ngx_connection_t *c,
rev->closed = 1;
wev->closed = 1;

#if defined(nginx_version) && (nginx_version >= 1001004)
if (c->pool) {
ngx_destroy_pool(c->pool);
}
#endif

ngx_free_connection(c);
}

Expand Down

0 comments on commit 714081d

Please sign in to comment.