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; }