diff options
Diffstat (limited to 'common/scummsys.h')
-rw-r--r-- | common/scummsys.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/scummsys.h b/common/scummsys.h index be4b821139..1ee3c00452 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -23,6 +23,7 @@ #define SCUMMSYS_H #include <stdlib.h> +#include <stdio.h> // TODO - use config.h, generated by configure #if defined(HAVE_CONFIG_H) @@ -432,6 +433,18 @@ #ifndef __PALM_OS__ void * operator new(size_t size); void operator delete(void *ptr); +// Temporary hack until we fully remove the new/delete operators: +// Since 'new' now returns a memory block inited to 0xE7E7E7E7 we might +// get some invocations of free() with that param. We check for those here. +// That allows us to set a debugger breakpoint to catch it. +inline void free_check(void *ptr) { + if ((uint)ptr == 0xE7E7E7E7UL) { + printf("ERROR: freeing 0xE7E7E7E7\n"); + exit(1); + } + free(ptr); +} +#define free(x) free_check(x) #endif #endif |