]> granicus.if.org Git - php/commitdiff
Fixed memory leak
authorIlia Alshanetsky <iliaa@php.net>
Wed, 30 Nov 2005 23:27:15 +0000 (23:27 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 30 Nov 2005 23:27:15 +0000 (23:27 +0000)
ext/pdo_pgsql/pgsql_driver.c
ext/pdo_pgsql/pgsql_statement.c

index 65fb948675b03ebd602b5c83a212840799758155..67042c5e0576d0b8f21b6058e6248afb262360fe 100644 (file)
@@ -248,7 +248,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
                /* that's all for now; we'll defer the actual prepare until the first execute call */
        
                if (nsql) {
-                       S->query = nsql;
+                       S->query = estrdup(nsql);
                } else {
                        S->query = estrdup(sql);
                }
index 088694b1057c73142d2975a4bd6fb11bba537eb9..4e771ea5a47c573516c9f3866effc91b9b8bf9f7 100644 (file)
@@ -76,7 +76,10 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
                efree(S->param_formats);
                S->param_formats = NULL;
        }
-
+       if (S->query) {
+               efree(S->query);
+               S->query = NULL;
+       }
 #endif
 
        if (S->cursor_name) {