summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_list.h10
-rw-r--r--sql/sql_union.cc1
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