iliaa Thu Aug 14 13:49:49 2003 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/pgsql pgsql.c Log: MFH: Fixed bug #25093 (Various leaks due to non-freed queries) Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.349 php-src/NEWS:1.1247.2.350 --- php-src/NEWS:1.1247.2.349 Thu Aug 14 10:38:50 2003 +++ php-src/NEWS Thu Aug 14 13:49:48 2003 @@ -1,6 +1,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 14 Aug 2003, Version 4.3.3RC4 +- Fixed bug #25093 (Various leaks due to non-freed queries). (Ilia) - Fixed bug #25084 (Make refer check not dependant on register_globals). (Ilia) - Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields). (Ilia) - Fixed bug #25044 (header("Location:") changing HTTP status). (Marcus) Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.244.2.21 php-src/ext/pgsql/pgsql.c:1.244.2.22 --- php-src/ext/pgsql/pgsql.c:1.244.2.21 Tue Aug 5 09:34:20 2003 +++ php-src/ext/pgsql/pgsql.c Thu Aug 14 13:49:48 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.244.2.21 2003/08/05 13:34:20 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.244.2.22 2003/08/14 17:49:48 iliaa Exp $ */ #include <stdlib.h> @@ -962,6 +962,7 @@ case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Query failed: %s.", PQerrorMessage(pgsql)); + PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ @@ -973,6 +974,7 @@ pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { + PQclear(pgsql_result); RETURN_FALSE; } break; @@ -1119,6 +1121,7 @@ ret = estrdup(tmp_name); } } + PQclear(result); } smart_str_free(&str); @@ -3173,6 +3176,7 @@ name = PQgetvalue(pg_result,i,0); add_assoc_zval(meta, name, elem); } + PQclear(pg_result); return SUCCESS; } @@ -4003,6 +4007,7 @@ pg_result = PQexec(pg_link, querystr->c); if (PQresultStatus(pg_result) == expect) { + PQclear(pg_result); return 0; } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to execute '%s'.", querystr->c); @@ -4472,9 +4477,9 @@ ret = php_pgsql_result2array(pg_result, ret_array TSRMLS_CC); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to execute '%s'.", querystr.c); - PQclear(pg_result); } - + PQclear(pg_result); + cleanup: if (!(opt & PGSQL_DML_NO_CONV)) { zval_dtor(ids_converted);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php