summaryrefslogtreecommitdiff
path: root/include/my_valgrind.h
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-01-28 15:54:17 +0200
committerMonty <monty@mariadb.org>2018-01-28 15:54:17 +0200
commitffcedfab46a7b2fad9b309aa1930e14068d968aa (patch)
treeed176889f70c5ae88b5cba027804163b6a106bb7 /include/my_valgrind.h
parent84514ec643aafe74b7ac256fa485013e222f942e (diff)
downloadmariadb-git-ffcedfab46a7b2fad9b309aa1930e14068d968aa.tar.gz
Added TRASH_FREED_MEMORY compilation option
One can use -DTRASH_FREED_MEMORY to enable TRASH macros. Useful to do when one suspects that there is accesses to freed memory. Extended my_free() to TRASH freed memory
Diffstat (limited to 'include/my_valgrind.h')
-rw-r--r--include/my_valgrind.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index dbbc4fad5ab..dd95098cc44 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -32,7 +32,7 @@
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
#endif /* HAVE_VALGRIND_MEMCHECK_H */
-#ifndef DBUG_OFF
+#if !defined(DBUG_OFF) || defined(TRASH_FREED_MEMORY)
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); memset(A, C, trash_tmp); MEM_UNDEFINED(A, trash_tmp); } while (0)
#else
#define TRASH_FILL(A,B,C) do{ const size_t trash_tmp __attribute__((unused)) = (B) ; MEM_CHECK_ADDRESSABLE(A,trash_tmp);MEM_UNDEFINED(A,trash_tmp);} while (0)