From a33547d8adb32e1bd23d1800bfb683d290f0772b Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Mon, 26 Dec 2005 11:22:05 +0000 Subject: [PATCH] Add memory-leak tracing to intdup. --- src/util/memory.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/util/memory.h b/src/util/memory.h index 9a649dfb5..cb5927d4e 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -164,10 +164,24 @@ mem_align_alloc__( /* This is out of place, but there is no better place. */ +#ifdef DEBUG_MEMLEAK +#define intdup(i) intdup__(__FILE__, __LINE__, i) +#else +#define intdup(i) intdup__(i) +#endif + static inline int * -intdup(int i) +intdup__( +#ifdef DEBUG_MEMLEAK + unsigned char *file, int line, +#endif + int i) { +#ifdef DEBUG_MEMLEAK + int *p = debug_mem_alloc(file, line, sizeof(*p)); +#else int *p = mem_alloc(sizeof(*p)); +#endif if (p) *p = i;