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 @@
/* 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 @@ class Sql_alloc
}
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) {}
......
......@@ -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
......
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