diff options
author | Matt Fleming <matt.fleming@intel.com> | 2013-01-17 14:33:25 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-02-21 12:55:10 +0000 |
commit | 07395d946e566263525f08f31692678422976a21 (patch) | |
tree | 56e5cf30b9cbcdf75d7e1a3b7ed62186bbbd69fb /dos/free.c | |
parent | b208ba467f678ed8e73f8d11fc0609634120cb83 (diff) | |
download | syslinux-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.c | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -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. */ |