diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-07-09 04:21:14 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-07-09 04:21:14 +0000 |
commit | ba66cac1cf1756da2434e8587f91af33d4d98d86 (patch) | |
tree | 780c82d6d5f587d324beb117949b81ad17a3407e /ext/pdo_mysql/mysql_statement.c | |
parent | c2f3636cf29209dc4683bc53512e95b5099e93f7 (diff) | |
download | php-git-ba66cac1cf1756da2434e8587f91af33d4d98d86.tar.gz |
Fixed memory leak
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rwxr-xr-x | ext/pdo_mysql/mysql_statement.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 5a6dd2fe76..3c5a4933c7 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -96,8 +96,18 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) S->result = mysql_stmt_result_metadata(S->stmt); if (S->result) { S->fields = mysql_fetch_fields(S->result); - stmt->column_count = (int)mysql_num_fields(S->result); + if (S->bound_result) { + int i; + for (i = 0; i < stmt->column_count; i++) { + efree(S->bound_result[i].buffer); + } + efree(S->bound_result); + efree(S->out_null); + efree(S->out_length); + } + + stmt->column_count = (int)mysql_num_fields(S->result); S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND)); S->out_null = ecalloc(stmt->column_count, sizeof(my_bool)); S->out_length = ecalloc(stmt->column_count, sizeof(unsigned long)); |