VMCache::Init(): Initialize the debug_* members before allocating the

VMCacheRef object, since that can fail, in which case the subsequently called
Delete() would use uninitialized pointers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35279 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-25 12:21:12 +00:00
parent b20de45ebd
commit ad6ad0f124
1 changed files with 6 additions and 1 deletions

View File

@ -594,6 +594,12 @@ VMCache::Init(uint32 cacheType)
type = cacheType;
fPageEventWaiters = NULL;
#if DEBUG_CACHE_LIST
debug_previous = NULL;
debug_next = NULL;
// initialize in case the following fails
#endif
fCacheRef = new(nogrow) VMCacheRef(this);
if (fCacheRef == NULL)
return B_NO_MEMORY;
@ -603,7 +609,6 @@ VMCache::Init(uint32 cacheType)
if (gDebugCacheList)
gDebugCacheList->debug_previous = this;
debug_previous = NULL;
debug_next = gDebugCacheList;
gDebugCacheList = this;