[Scummvm-cvs-logs] scummvm master -> b585addc23de25c019f250986d50c0373219571d

bluegr bluegr at gmail.com
Tue Dec 17 00:16:59 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b585addc23 COMMON: Fix mismatched new/delete in the MemoryPool class


Commit: b585addc23de25c019f250986d50c0373219571d
    https://github.com/scummvm/scummvm/commit/b585addc23de25c019f250986d50c0373219571d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-12-16T15:16:28-08:00

Commit Message:
COMMON: Fix mismatched new/delete in the MemoryPool class

Memory is allocated with new in Hashmap::allocNode() and incorrectly
freed with free() in ~MemoryPool() and freeUnusedPages().
Issue reported by Dr. Memory

Changed paths:
    common/memorypool.cpp



diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index e3742ee..3a31fd5 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -56,7 +56,7 @@ MemoryPool::~MemoryPool() {
 #endif
 
 	for (size_t i = 0; i < _pages.size(); ++i)
-		::free(_pages[i].start);
+		delete _pages[i].start;
 }
 
 void MemoryPool::allocPage() {
@@ -152,7 +152,7 @@ void MemoryPool::freeUnusedPages() {
 					iter2 = *(void ***)iter2;
 			}
 
-			::free(_pages[i].start);
+			delete _pages[i].start;
 			++freedPagesCount;
 			_pages[i].start = NULL;
 		}






More information about the Scummvm-git-logs mailing list