Commit 4e4d6186 authored by serg@serg.mylan's avatar serg@serg.mylan

catch accesses to deleted objects

double delete bug fixed
parent f0f9e0d7
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
/* mysql standard class memoryallocator */ /* 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 class Sql_alloc
{ {
public: public:
...@@ -34,8 +40,8 @@ class Sql_alloc ...@@ -34,8 +40,8 @@ class Sql_alloc
} }
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { 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) { TRASH(ptr, size); }
static void operator delete[](void *ptr, size_t size) {} static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
#ifdef HAVE_purify #ifdef HAVE_purify
bool dummy; bool dummy;
inline Sql_alloc() :dummy(0) {} inline Sql_alloc() :dummy(0) {}
......
...@@ -445,6 +445,7 @@ int st_select_lex_unit::cleanup() ...@@ -445,6 +445,7 @@ int st_select_lex_unit::cleanup()
if (union_result) if (union_result)
{ {
delete union_result; delete union_result;
union_result=0; // Safety
if (table) if (table)
free_tmp_table(thd, table); free_tmp_table(thd, table);
table= 0; // Safety table= 0; // Safety
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment