PHP 4.0 Bug #9562: Memory leak in ext/pgsql/pgsql.c
| From: | ales at deuce dot sta dot si | Date: | Mon, 05 Mar 2001 15:11:09 +0000 |
| Subject: | PHP 4.0 Bug #9562: Memory leak in ext/pgsql/pgsql.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-47975@lists.php.net to get a copy of this message | ||
From: ales@deuce.sta.si
Operating system: Solaris, probably also others
PHP version: 4.0.4pl1
PHP Bug Type: Reproduceable crash
Bug description: Memory leak in ext/pgsql/pgsql.c
Script for reproducing bug:
while(!($con=@pg_pconnect("dbname=web")))
{
sleep(1);
}
The system must be under heavy load for bug to become apparent.
Suggested correction in ext/pgsql/pgsql.c (added lines are marked with ***):
if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
*** if(pgsql) {
*** PQfinish(pgsql);
*** pgsql=0;
*** }
php_error(E_WARNING,"Unable to connect to PostgreSQL server:
%s",PQerrorMessage(pgsql));
efree(hashed_details);
RETURN_FALSE;
}
--
Edit Bug report at: http://bugs.php.net/?id=9562&edit=1