]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #25093 (Various leaks due to non-freed queries)
authorIlia Alshanetsky <iliaa@php.net>
Thu, 14 Aug 2003 17:49:48 +0000 (17:49 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 14 Aug 2003 17:49:48 +0000 (17:49 +0000)
NEWS
ext/pgsql/pgsql.c

diff --git a/NEWS b/NEWS
index e387939473b806ed04d224728adbfee9b6465f0d..627e4a87f557f7a819f52b6c852824b20e65af6f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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 175a7c5d84de14f129a74de8fa7095da5019f869..0f43f35dec2c4b8a78b314ce5f85d00ff1737ee6 100644 (file)
@@ -962,6 +962,7 @@ PHP_FUNCTION(pg_query)
                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 @@ PHP_FUNCTION(pg_query)
                                pg_result->row = 0;
                                ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result);
                        } else {
+                               PQclear(pgsql_result);
                                RETURN_FALSE;
                        }
                        break;
@@ -1119,6 +1121,7 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
                                ret = estrdup(tmp_name);
                        }
                }
+               PQclear(result);
        }
 
        smart_str_free(&str);
@@ -3173,6 +3176,7 @@ PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *me
                name = PQgetvalue(pg_result,i,0);
                add_assoc_zval(meta, name, elem);
        }
+       PQclear(pg_result);
        
        return SUCCESS;
 }
@@ -4003,6 +4007,7 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
 
                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 @@ PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array,
                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);