kernel: follow-up to hrev56619: use new(std::nothrow)
to handle allocation failures. Change-Id: I15d84b24dcea17741382b1d5285acf6219a39811 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5868 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
07ca9bce14
commit
f0e187c3fd
@ -1133,7 +1133,7 @@ start_watching(const char* base, const char* sub)
|
||||
static struct driver_entry*
|
||||
new_driver_entry(const char* path, dev_t device, ino_t node)
|
||||
{
|
||||
driver_entry* entry = new driver_entry;
|
||||
driver_entry* entry = new(std::nothrow) driver_entry;
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -1519,7 +1519,7 @@ legacy_driver_probe(const char* subPath)
|
||||
extern "C" status_t
|
||||
legacy_driver_init(void)
|
||||
{
|
||||
sDriverHash = new DriverTable();
|
||||
sDriverHash = new(std::nothrow) DriverTable();
|
||||
if (sDriverHash == NULL || sDriverHash->Init(DRIVER_HASH_SIZE) != B_OK)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
@ -468,7 +468,7 @@ register_low_resource_handler(low_resource_func function, void* data,
|
||||
TRACE(("register_low_resource_handler(function = %p, data = %p)\n",
|
||||
function, data));
|
||||
|
||||
low_resource_handler *newHandler = new low_resource_handler;
|
||||
low_resource_handler *newHandler = new(std::nothrow) low_resource_handler;
|
||||
if (newHandler == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ swap_file_add(const char* path)
|
||||
}
|
||||
|
||||
// do the allocations and prepare the swap_file structure
|
||||
swap_file* swap = new swap_file;
|
||||
swap_file* swap = new(std::nothrow) swap_file;
|
||||
if (swap == NULL) {
|
||||
close(fd);
|
||||
return B_NO_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user