From: Ilia Alshanetsky Date: Thu, 29 Jan 2004 02:55:33 +0000 (+0000) Subject: MFH: Fixed bug #27007 (missing connection closure when connect fails in X-Git-Tag: php-4.3.5RC2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ca21fdf964b03aa92b99674f80e567cb4544841;p=php MFH: Fixed bug #27007 (missing connection closure when connect fails in pgsql) --- diff --git a/NEWS b/NEWS index 8111763e6d..7a34ea73ca 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ PHP 4 NEWS - Fixed bug #27037 (fixed possible crash in apache2handler output code). (Ilia) - Fixed bug #27011 (64bit int/long confusion in preg_match*() functions). (Ilia) +- Fixed bug #27007 (missing connection closure when connect fails in pgsql). + (Ilia) - Fixed bug #26974 (rename() doesn't check the destination file against safe_mode/open_basedir). (Ilia) - Fixed bug #26973 (*printf() '+' modifier broken). (Jani) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 2e36950051..bef8b187a4 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -671,6 +671,9 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); + if (pgsql) { + PQfinish(pgsql); + } goto err; }