summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-05-04 23:53:08 +1200
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-05-04 23:53:08 +1200
commitd0216ce68d508672ca710319c55c6d5769756426 (patch)
tree908e30c5de7af1f7552b80cb87e23d3e02c5c296
parent6043dac0ea05806d1562f71c34675850ef988538 (diff)
parenta35549d0ad380a3a0b1726cc6ec723bc80b6ee01 (diff)
downloadpsycopg2-d0216ce68d508672ca710319c55c6d5769756426.tar.gz
Merge branch 'client-encoding-leak'
-rw-r--r--NEWS7
-rw-r--r--psycopg/connection_int.c5
2 files changed, 11 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a1c56d0..0814651 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,13 @@
Current release
---------------
+What's new in psycopg 2.8.6
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fixed memory leak changing connection encoding to the current one
+ (:ticket:`#1101`).
+
+
What's new in psycopg 2.8.5
^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 78dbd46..da8a464 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -1389,7 +1389,10 @@ conn_set_client_encoding(connectionObject *self, const char *pgenc)
/* If the current encoding is equal to the requested one we don't
issue any query to the backend */
- if (strcmp(self->encoding, clean_enc) == 0) return 0;
+ if (strcmp(self->encoding, clean_enc) == 0) {
+ res = 0;
+ goto exit;
+ }
Py_BEGIN_ALLOW_THREADS;
pthread_mutex_lock(&self->lock);