From 55eb800fe8eb48a13e7f45671284ce5eb536fbee Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 16 Oct 2006 23:22:17 +0000 Subject: Fix memory corruption when the number of not-leaks exceeds the table size. (refs #3) --- lib/common/DebugMemLeakFinder.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index 17a20a6d..49199f5e 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -183,7 +183,9 @@ void memleakfinder_notaleak(void *ptr) } else { - sNotLeaksPre[sNotLeaksPreNum++] = ptr; + if ( sNotLeaksPreNum < + (unsigned)( sizeof(sNotLeaksPre)/sizeof(*sNotLeaksPre) ) ) + sNotLeaksPre[sNotLeaksPreNum++] = ptr; } /* { std::map::iterator i(sMallocBlocks.find(ptr)); -- cgit v1.2.3