From 14ede384fe113fbccd38d9389cdcb5391ca65403 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Jan 2004 08:09:42 +0100 Subject: [PATCH] catch accesses to deleted objects double delete bug fixed sql/sql_list.h: catch accesses to deleted objects sql/sql_union.cc: double delete fixed --- sql/sql_list.h | 10 ++++++++-- sql/sql_union.cc | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sql/sql_list.h b/sql/sql_list.h index 0972d0341f6..c7faef88358 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -21,6 +21,12 @@ /* mysql standard class memoryallocator */ +#ifdef PEDANTIC_SAFEMALLOC +#define TRASH(XX,YY) bfill((XX), (YY), 0x8F) +#else +#define TRASH(XX,YY) /* no-op */ +#endif + class Sql_alloc { public: @@ -34,8 +40,8 @@ public: } static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } - static void operator delete(void *ptr, size_t size) {} /*lint -e715 */ - static void operator delete[](void *ptr, size_t size) {} + static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } + static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); } #ifdef HAVE_purify bool dummy; inline Sql_alloc() :dummy(0) {} diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 1cb01c6b3ef..226086d0d24 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -445,6 +445,7 @@ int st_select_lex_unit::cleanup() if (union_result) { delete union_result; + union_result=0; // Safety if (table) free_tmp_table(thd, table); table= 0; // Safety