From 76833ac489e01efa336fc12b2e565dc1d3ad3fd8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Nov 2006 21:35:20 +0300 Subject: [PATCH] A fix for Bug#24486 "Valgrind warnings: sp_head(), deadlock_innodb:events_grant". This was a memory leak introduced by the patch for Bug 22830. Post-review fixes. sql/sql_parse.cc: A fix for Bug#24486 "Valgrind warnings: sp_head(), deadlock_innodb:events_grant": delete the sphead object before returning with an error. --- sql/sql_parse.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index afd242d922e..1c0ae7b8e2c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3925,6 +3925,7 @@ end_with_restore_list: } case SQLCOM_CREATE_EVENT: case SQLCOM_ALTER_EVENT: + do { DBUG_ASSERT(lex->event_parse_data); if (lex->table_or_sp_used()) @@ -3950,16 +3951,15 @@ end_with_restore_list: if (!res) send_ok(thd); - /* Don't do it, if we are inside a SP */ - if (!thd->spcont) - { - delete lex->sphead; - lex->sphead= NULL; - } - - /* lex->unit.cleanup() is called outside, no need to call it here */ - break; + } while (0); + /* Don't do it, if we are inside a SP */ + if (!thd->spcont) + { + delete lex->sphead; + lex->sphead= NULL; } + /* lex->unit.cleanup() is called outside, no need to call it here */ + break; case SQLCOM_DROP_EVENT: case SQLCOM_SHOW_CREATE_EVENT: {