summaryrefslogtreecommitdiff
path: root/dos/free.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-01-17 14:33:25 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-02-21 12:55:10 +0000
commit07395d946e566263525f08f31692678422976a21 (patch)
tree56e5cf30b9cbcdf75d7e1a3b7ed62186bbbd69fb /dos/free.c
parentb208ba467f678ed8e73f8d11fc0609634120cb83 (diff)
downloadsyslinux-07395d946e566263525f08f31692678422976a21.tar.gz
mem: Add magic field to detect memory corruption
Very little checking is performed on the validity of freelist metadata. Add a magic field to struct arena_header which can be used to detect memory corruption or whether a user tries to free something that isn't a malloc pointer. This feature can be enabled with -DDEBUG_MALLOC. Turn it on for development in mk/devel.mk. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'dos/free.c')
-rw-r--r--dos/free.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/dos/free.c b/dos/free.c
index 020dc157..b0b72ef7 100644
--- a/dos/free.c
+++ b/dos/free.c
@@ -67,10 +67,6 @@ void free(void *ptr)
ah = (struct free_arena_header *)
((struct arena_header *)ptr - 1);
-#ifdef DEBUG_MALLOC
- assert(ah->a.type == ARENA_TYPE_USED);
-#endif
-
__free_block(ah);
/* Here we could insert code to return memory to the system. */