From bb40a6854756fe8ef11fa891b5eeb03d8e08cb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 May 2006 10:14:36 +0000 Subject: [PATCH] * The mapping is now also removed from the area list in case creating the area failed. * "base" is no longer used uninitialized in combination with B_BASE_ADDRESS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17304 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/ServerMemoryAllocator.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kits/app/ServerMemoryAllocator.cpp b/src/kits/app/ServerMemoryAllocator.cpp index 1c7a405e5a..2ed6cb46a5 100644 --- a/src/kits/app/ServerMemoryAllocator.cpp +++ b/src/kits/app/ServerMemoryAllocator.cpp @@ -68,6 +68,7 @@ ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base } status_t status = B_ERROR; + uint32 addressSpec = B_ANY_ADDRESS; void* base; #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST if (!readOnly) { @@ -75,15 +76,18 @@ ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base base = (void*)0x60000000; status = _kern_reserve_heap_address_range((addr_t*)&base, B_BASE_ADDRESS, 128 * 1024 * 1024); + addressSpec = status == B_OK ? B_EXACT_ADDRESS : B_BASE_ADDRESS; } #endif mapping->local_area = clone_area(readOnly ? "server read-only memory" : "server_memory", - &base, status == B_OK ? B_EXACT_ADDRESS : B_BASE_ADDRESS, - B_READ_AREA | (readOnly ? 0 : B_WRITE_AREA), serverArea); + &base, addressSpec, B_READ_AREA | (readOnly ? 0 : B_WRITE_AREA), serverArea); if (mapping->local_area < B_OK) { status = mapping->local_area; + + fAreas.RemoveItem(mapping); delete mapping; + return status; }