diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:22:17 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:22:17 +0000 |
commit | 55eb800fe8eb48a13e7f45671284ce5eb536fbee (patch) | |
tree | 7d2fe2d2ab153f6ab48c394a8b6628008eb77dce /lib | |
parent | 68d89b9fe9778478fa4884b4cbfa24c5b99df8ee (diff) |
Fix memory corruption when the number of not-leaks exceeds the table size.
(refs #3)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/DebugMemLeakFinder.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<void *, MallocBlockInfo>::iterator i(sMallocBlocks.find(ptr)); |