From: Ilia Alshanetsky Date: Wed, 30 Nov 2005 23:27:15 +0000 (+0000) Subject: Fixed memory leak X-Git-Tag: php-5.1.2RC1~286 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=911355bee897abca12bcfcb4353c58a65605aed1;p=php Fixed memory leak --- diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 65fb948675..67042c5e05 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -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); } diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 088694b105..4e771ea5a4 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -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) {