From a5de454f45e09c8d4740eba62f2ae2fdb6f9904d Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 1 May 2010 18:50:21 +0000 Subject: [PATCH] VM{Kernel,User}Area::Create(): On error free the area's memory heeding the given allocation flags. Could deadlock otherwise. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36571 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/VMKernelArea.cpp | 3 ++- src/system/kernel/vm/VMUserArea.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/vm/VMKernelArea.cpp b/src/system/kernel/vm/VMKernelArea.cpp index 8328864be2..941316cf48 100644 --- a/src/system/kernel/vm/VMKernelArea.cpp +++ b/src/system/kernel/vm/VMKernelArea.cpp @@ -33,7 +33,8 @@ VMKernelArea::Create(VMAddressSpace* addressSpace, const char* name, return NULL; if (area->Init(name, allocationFlags) != B_OK) { - delete area; + area->~VMKernelArea(); + free_etc(area, allocationFlags); return NULL; } diff --git a/src/system/kernel/vm/VMUserArea.cpp b/src/system/kernel/vm/VMUserArea.cpp index f40096e147..f515fef262 100644 --- a/src/system/kernel/vm/VMUserArea.cpp +++ b/src/system/kernel/vm/VMUserArea.cpp @@ -33,7 +33,8 @@ VMUserArea::Create(VMAddressSpace* addressSpace, const char* name, return NULL; if (area->Init(name, allocationFlags) != B_OK) { - delete area; + area->~VMUserArea(); + free_etc(area, allocationFlags); return NULL; }