[PHP-DEV] PHP 4.0 Bug #9562: Memory leak in ext/pgsql/pgsql.c From: ales <email protected>
Date: 03/05/01

From: ales <email protected>
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= <email protected>("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

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>