#39663 [Opn->Asn]: Memory leak in pg_get_notify
| From: | tony2001@php.net | Date: | Tue, 28 Nov 2006 21:05:48 +0000 |
| Subject: | #39663 [Opn->Asn]: Memory leak in pg_get_notify | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105580@lists.php.net to get a copy of this message | ||
ID: 39663
Updated by: tony2001@php.net
Reported By: matteo at beccati dot com
-Status: Open
+Status: Assigned
Bug Type: PostgreSQL related
Operating System: *
PHP Version: 5.2.0
-Assigned To:
+Assigned To: iliaa
Previous Comments:
------------------------------------------------------------------------
[2006-11-28 17:48:01] matteo at beccati dot com
Description:
------------
While toying with the pgsql extesion I found that the pgsql_notify
struct is not freed as pointed out in the PostgreSQL documentation:
"After processing a PGnotify object returned by PQnotifies, be sure to
free it with PQfreemem." (see:
http://www.postgresql.org/docs/8.1/interactive/libpq-notify.html
).
This could lead to memory leaks as far as I can see.
Reproduce code:
---------------
Here is the patch:
--- ext/pgsql/pgsql.c 2006-10-06 23:45:10.000000000 +0200
+++ ext/pgsql/pgsql_new.c 2006-11-28 18:21:40.000000000 +0100
@@ -4347,6 +4347,8 @@
add_assoc_string(return_value, "message",
pgsql_notify->relname, 1);
add_assoc_long(return_value, "pid",
pgsql_notify->be_pid);
}
+
+ PQfreemem(pgsql_notify);
}
/* }}} */
BTW, pg_*_bytea functions should use PQfreemem too, even if it is
simply a wrapper.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39663&edit=1