Delete Items created during Prepared Stat (memory leak bug) (Bug #3451)

This commit is contained in:
monty@mysql.com 2004-05-05 12:40:33 +03:00
parent 7e3cf5958c
commit 82c50dc49d
2 changed files with 6 additions and 2 deletions

View file

@ -1424,6 +1424,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case COM_EXECUTE:
{
thd->free_list= NULL;
mysql_stmt_execute(thd, packet, packet_length);
break;
}

View file

@ -1485,9 +1485,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
thd->stmt_backup.set_statement(thd);
thd->set_statement(stmt);
reset_stmt_for_execute(stmt);
#ifndef EMBEDDED_LIBRARY
if (stmt->param_count)
{
@ -1526,6 +1524,11 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
cleanup_items(stmt->free_list);
close_thread_tables(thd); // to close derived tables
thd->set_statement(&thd->stmt_backup);
/*
Free Items that were created during this execution of the PS by query
optimizer.
*/
free_items(thd->free_list);
DBUG_VOID_RETURN;
set_params_data_err: