]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: plug memory leak receiving notifications in python libpq wrapper
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 16 Nov 2023 01:27:14 +0000 (02:27 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 16 Nov 2023 01:28:52 +0000 (02:28 +0100)
Close #679.

docs/news.rst
psycopg/psycopg/pq/pq_ctypes.py

index 0ecea199628436cbd1a1fe2a677b3aa8153ec545..e036378978d62a622fbac58eb0211c4314c5d034 100644 (file)
@@ -20,6 +20,8 @@ Psycopg 3.1.13 (unreleased)
   consistently with :pep:`475` guideline (:ticket:`#667`).
 - Fix support for connection strings with multiple hosts/ports and for the
   ``load_balance_hosts`` connection parameter (:ticket:`#674`).
+- Fix memory leak receiving notifications in Python implementation
+  (:ticket:`#679`).
 
 
 Current release
index 204e384847567d36c2904517a2fa8f38822f5f3f..fdf2ad8a87242ae0cec44e57d12d4fe053a415d5 100644 (file)
@@ -568,8 +568,9 @@ class PGconn:
         ptr = impl.PQnotifies(self._pgconn_ptr)
         if ptr:
             c = ptr.contents
-            return PGnotify(c.relname, c.be_pid, c.extra)
+            rv = PGnotify(c.relname, c.be_pid, c.extra)
             impl.PQfreemem(ptr)
+            return rv
         else:
             return None