php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9562 Memory leak in ext/pgsql/pgsql.c
Submitted: 2001-03-05 10:11 UTC Modified: 2001-04-29 13:35 UTC
From: ales at deuce dot sta dot si Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.4pl1 OS: Solaris, probably also others
Private report: No CVE-ID: None
 [2001-03-05 10:11 UTC] ales at deuce dot sta dot si
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;
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-29 13:35 UTC] zeev@php.net
Your fix was incorporated to the CVS, and will be a part of PHP 4.0.6.  Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC