]> granicus.if.org Git - php/commitdiff
Added cursor closer handler.
authorIlia Alshanetsky <iliaa@php.net>
Sat, 9 Jul 2005 04:54:04 +0000 (04:54 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 9 Jul 2005 04:54:04 +0000 (04:54 +0000)
Fixed memory leak.

ext/pdo_pgsql/pgsql_driver.c
ext/pdo_pgsql/pgsql_statement.c

index 4594da8b1ada4f59c16b2bf2ddeb2409f49fce6e..038b0e99c7b7880cd7b133212818e58b14fcb621 100644 (file)
@@ -184,6 +184,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
                case PGRES_COMMAND_OK:
                case PGRES_TUPLES_OK:
                        /* it worked */
+                       PQclear(res);
                        return 1;
 
                case PGRES_BAD_RESPONSE:
@@ -191,6 +192,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
                         * PDO emulate it */
                        efree(S->stmt_name);
                        S->stmt_name = NULL;
+                       PQclear(res);
                        break;
 
                default:
index 787d671ae7bfb54f484a93c47824e8cdae3e3093..3979bd8324e731978f5e794579097f4504ca5dd6 100644 (file)
@@ -498,6 +498,11 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return
        return 1;
 }
 
+static int pdo_pgsql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
+{
+       return 1;
+}
+
 struct pdo_stmt_methods pgsql_stmt_methods = {
        pgsql_stmt_dtor,
        pgsql_stmt_execute,
@@ -508,7 +513,8 @@ struct pdo_stmt_methods pgsql_stmt_methods = {
        NULL, /* set_attr */
        NULL, /* get_attr */
        pgsql_stmt_get_column_meta,
-       NULL  /* next_rowset */
+       NULL,  /* next_rowset */
+       pdo_pgsql_stmt_cursor_closer
 };
 
 /*