* Fixed CID 1472: "next" could be NULL and dereferenced.
* Simplified code a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38194 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009-2010, Ingo Weinhold, [email protected].
|
* Copyright 2009-2010, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2002-2009, Axel Dörfler, [email protected].
|
* Copyright 2002-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@@ -192,24 +192,19 @@ VMUserAddressSpace::CanResizeArea(VMArea* area, size_t newSize)
|
|||||||
{
|
{
|
||||||
VMUserArea* next = fAreas.GetNext(static_cast<VMUserArea*>(area));
|
VMUserArea* next = fAreas.GetNext(static_cast<VMUserArea*>(area));
|
||||||
addr_t newEnd = area->Base() + (newSize - 1);
|
addr_t newEnd = area->Base() + (newSize - 1);
|
||||||
if (next == NULL) {
|
|
||||||
if (fEndAddress >= newEnd)
|
if (next == NULL)
|
||||||
return true;
|
return fEndAddress >= newEnd;
|
||||||
} else {
|
|
||||||
if (next->Base() > newEnd)
|
if (next->Base() > newEnd)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
// If the area was created inside a reserved area, it can
|
// If the area was created inside a reserved area, it can
|
||||||
// also be resized in that area
|
// also be resized in that area
|
||||||
// TODO: if there is free space after the reserved area, it could
|
// TODO: if there is free space after the reserved area, it could
|
||||||
// be used as well...
|
// be used as well...
|
||||||
if (next->id == RESERVED_AREA_ID && next->cache_offset <= area->Base()
|
return next->id == RESERVED_AREA_ID && next->cache_offset <= area->Base()
|
||||||
&& next->Base() + (next->Size() - 1) >= newEnd) {
|
&& next->Base() + (next->Size() - 1) >= newEnd;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user