summaryrefslogtreecommitdiff
path: root/psycopg/connection_int.c
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r--psycopg/connection_int.c7
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;
}