diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2013-03-16 11:56:38 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2013-03-16 11:56:38 +0000 |
commit | 66d6c68dcc3a3f20742b29edbc005c7417c4b374 (patch) | |
tree | dc4c1be140a8c971f8b32939d7a19002aba83251 /psycopg/connection_int.c | |
parent | 7abe1775d0bc037494576691172ece437dea3761 (diff) | |
download | psycopg2-66d6c68dcc3a3f20742b29edbc005c7417c4b374.tar.gz |
Properly cleanup memory of broken connections
Fixed ticket #148.
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r-- | psycopg/connection_int.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index ad49575..0e5cb3d 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -918,7 +918,8 @@ conn_poll(connectionObject *self) void conn_close(connectionObject *self) { - if (self->closed) { + /* a connection with closed == 2 still requires cleanup */ + if (self->closed == 1) { return; } @@ -936,7 +937,7 @@ conn_close(connectionObject *self) void conn_close_locked(connectionObject *self) { - if (self->closed) { + if (self->closed == 1) { return; } @@ -957,6 +958,8 @@ void conn_close_locked(connectionObject *self) PQfinish(self->pgconn); self->pgconn = NULL; Dprintf("conn_close: PQfinish called"); + } + if (self->cancel) { PQfreeCancel(self->cancel); self->cancel = NULL; } |