]> 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:27:14 +0000 (02:27 +0100)
Close #679.

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

index 7d63c0030bcb74c2f9dc9f6b4ede3c5c4f67f585..ecd88a12b657dd53604704b53ff7247124bae13e 100644 (file)
@@ -40,6 +40,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 07c2d95cca50d57c4823aad837441faa34b3b977..5f32031ca981bacd84cd6086b1af4795d26d1485 100644 (file)
@@ -604,8 +604,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