From 6560c2aa040453084fbc841de1a842580767f30e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Jan 2007 21:16:48 +0300 Subject: Fix for memory leaks introduced with the push of patch for bug#22740. Original patch did not have these leaks, they were introduced later during manual applying of the patch. sql/event_data_objects.cc: Original patch was not aware of the requirement to delete lex.sphead before doing anything else (bug#21856), and that was missed when the patch was applied later. sql/event_scheduler.cc: The line was lost during manual patch applying. --- sql/event_data_objects.cc | 15 ++++++++++----- sql/event_scheduler.cc | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 198f6518184..b1724a28820 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1811,16 +1811,21 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root) DBUG_PRINT("error", ("error during compile or thd->is_fatal_error: %d", thd->is_fatal_error)); /* - Free lex associated resources - QQ: Do we really need all this stuff here? + The first thing we do after parse error is freeing sp_head to + ensure that we have restored original memroot. */ + if (lex.sphead) + { + /* Clean up after failed stored procedure/function */ + delete lex.sphead; + lex.sphead= NULL; + } + lex.unit.cleanup(); + sql_print_error("SCHEDULER: Error during compilation of %s.%s or " "thd->is_fatal_error: %d", dbname.str, name.str, thd->is_fatal_error); - lex.unit.cleanup(); - delete lex.sphead; - sphead= lex.sphead= NULL; ret= EVEX_COMPILE_ERROR; goto done; } diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 1013f5af3a8..accf2ad03be 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -322,6 +322,8 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event) job_data->dbname.str, job_data->name.str, job_data->definer.str); else if (ret == EVEX_MICROSECOND_UNSUP) + sql_print_information("SCHEDULER: MICROSECOND is not supported"); + end: delete job_data; -- cgit v1.2.1