From 82029bdae870b0e257a54929116ddfb6da9efdca Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Sat, 16 Sep 2006 23:25:56 +0000 Subject: [PATCH] added missing nothrow parameter git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18868 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../file_systems/amiga_ffs/Directory.cpp | 6 ++-- .../loader/file_systems/amiga_ffs/File.cpp | 2 +- .../loader/file_systems/amiga_ffs/Volume.cpp | 4 +-- .../loader/file_systems/bfs/Directory.cpp | 2 +- .../boot/loader/file_systems/bfs/Stream.cpp | 6 ++-- .../boot/loader/file_systems/bfs/bfs.cpp | 4 +-- .../loader/file_systems/hfs_plus/hfs_plus.cpp | 2 +- .../boot/loader/file_systems/tarfs/tarfs.cpp | 8 ++--- src/system/boot/loader/menu.cpp | 34 +++++++++---------- src/system/boot/loader/vfs.cpp | 4 +-- .../boot/platform/bios_ia32/devices.cpp | 4 +-- src/system/boot/platform/bios_ia32/menu.cpp | 6 ++-- src/system/boot/platform/bios_ia32/smp.cpp | 4 +-- src/system/boot/platform/bios_ia32/video.cpp | 10 +++--- .../boot/platform/openfirmware/devices.cpp | 4 +-- src/system/kernel/boot_item.cpp | 2 +- src/system/kernel/cache/block_cache.cpp | 8 ++--- src/system/kernel/device_manager/probe.cpp | 8 +++-- src/system/kernel/fs/devfs.cpp | 7 ++-- 19 files changed, 66 insertions(+), 59 deletions(-) diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp b/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp index 75739b8168..c299717118 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp @@ -57,7 +57,7 @@ Directory::Open(void **_cookie, int mode) { _inherited::Open(_cookie, mode); - HashIterator *iterator = new HashIterator(fVolume.Device(), fNode); + HashIterator *iterator = new(nothrow) HashIterator(fVolume.Device(), fNode); if (iterator == NULL) return B_NO_MEMORY; @@ -102,9 +102,9 @@ Directory::Lookup(const char *name, bool traverseLinks) if (node->GetName(fileName, sizeof(fileName)) == B_OK && !strcmp(name, fileName)) { if (node->IsFile()) - return new File(fVolume, block); + return new(nothrow) File(fVolume, block); if (node->IsDirectory()) - return new Directory(fVolume, block); + return new(nothrow) Directory(fVolume, block); return NULL; } diff --git a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp index 269c6896ad..3647db87f6 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp @@ -185,7 +185,7 @@ File::InitCheck() status_t File::Open(void **_cookie, int mode) { - Stream *stream = new Stream(fVolume.Device(), fNode); + Stream *stream = new(nothrow) Stream(fVolume.Device(), fNode); if (stream == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp b/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp index b94f62d016..ee9c3c1558 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp @@ -75,7 +75,7 @@ Volume::Volume(boot::Partition *partition) buffer = newBuffer; fRootNode.SetTo(buffer, blockSize); - fRoot = new Directory(*this, fRootNode); + fRoot = new(nothrow) Directory(*this, fRootNode); // fRoot will free the buffer for us upon destruction } @@ -103,7 +103,7 @@ Volume::InitCheck() static status_t amiga_ffs_get_file_system(boot::Partition *partition, ::Directory **_root) { - Volume *volume = new Volume(partition); + Volume *volume = new(nothrow) Volume(partition); if (volume == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/bfs/Directory.cpp b/src/system/boot/loader/file_systems/bfs/Directory.cpp index 8b770f5b22..83b0caa86c 100644 --- a/src/system/boot/loader/file_systems/bfs/Directory.cpp +++ b/src/system/boot/loader/file_systems/bfs/Directory.cpp @@ -63,7 +63,7 @@ Directory::Open(void **_cookie, int mode) { _inherited::Open(_cookie, mode); - *_cookie = (void *)new TreeIterator(&fTree); + *_cookie = (void *)new(nothrow) TreeIterator(&fTree); if (*_cookie == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/bfs/Stream.cpp b/src/system/boot/loader/file_systems/bfs/Stream.cpp index bf0f7930f9..75e1bb0c4e 100644 --- a/src/system/boot/loader/file_systems/bfs/Stream.cpp +++ b/src/system/boot/loader/file_systems/bfs/Stream.cpp @@ -403,12 +403,12 @@ Stream::NodeFactory(Volume &volume, off_t id) return NULL; if (stream.IsContainer()) - return new Directory(stream); + return new(nothrow) Directory(stream); if (stream.IsSymlink()) - return new Link(stream); + return new(nothrow) Link(stream); - return new File(stream); + return new(nothrow) File(stream); } diff --git a/src/system/boot/loader/file_systems/bfs/bfs.cpp b/src/system/boot/loader/file_systems/bfs/bfs.cpp index 1c3a29d088..70acf33a58 100644 --- a/src/system/boot/loader/file_systems/bfs/bfs.cpp +++ b/src/system/boot/loader/file_systems/bfs/bfs.cpp @@ -55,7 +55,7 @@ Volume::Volume(boot::Partition *partition) TRACE(("bfs: we do have a valid super block (name = %s)!\n", fSuperBlock.name)); - fRootNode = new BFS::Directory(*this, Root()); + fRootNode = new(nothrow) BFS::Directory(*this, Root()); if (fRootNode == NULL) return; @@ -135,7 +135,7 @@ Volume::ToBlockRun(off_t block) const static status_t bfs_get_file_system(boot::Partition *partition, ::Directory **_root) { - Volume *volume = new Volume(partition); + Volume *volume = new(nothrow) Volume(partition); if (volume == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp b/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp index 0d547d8ee6..9b1a7b0763 100644 --- a/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp +++ b/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp @@ -38,7 +38,7 @@ HFSPlus::get_root_block(int fDevice, char *buffer, int32 blockSize, off_t partit static status_t hfs_plus_get_file_system(boot::Partition *partition, ::Directory **_root) { -/* Volume *volume = new Volume(partition); +/* Volume *volume = new(nothrow) Volume(partition); if (volume == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/tarfs/tarfs.cpp b/src/system/boot/loader/file_systems/tarfs/tarfs.cpp index 82e21d8559..4bafdb4947 100644 --- a/src/system/boot/loader/file_systems/tarfs/tarfs.cpp +++ b/src/system/boot/loader/file_systems/tarfs/tarfs.cpp @@ -296,7 +296,7 @@ TarFS::Directory::Open(void **_cookie, int mode) { _inherited::Open(_cookie, mode); - EntryIterator *iterator = new EntryIterator(fEntries.GetIterator()); + EntryIterator *iterator = new(nothrow) EntryIterator(fEntries.GetIterator()); if (iterator == NULL) return B_NO_MEMORY; @@ -414,7 +414,7 @@ TarFS::Directory::AddDirectory(char *dirName, TarFS::Directory **_dir) return B_ERROR; } else { // doesn't exist yet -- create it - dir = new TarFS::Directory(dirName); + dir = new(nothrow) TarFS::Directory(dirName); if (!dir) return B_NO_MEMORY; @@ -456,7 +456,7 @@ TarFS::Directory::AddFile(tar_header *header) } // create the file - TarFS::File *file = new TarFS::File(header, leaf); + TarFS::File *file = new(nothrow) TarFS::File(header, leaf); if (!file) return B_NO_MEMORY; @@ -654,7 +654,7 @@ TarFS::Volume::Init(boot::Partition *partition) static status_t tarfs_get_file_system(boot::Partition *partition, ::Directory **_root) { - TarFS::Volume *volume = new TarFS::Volume; + TarFS::Volume *volume = new(nothrow) TarFS::Volume; if (volume == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/menu.cpp b/src/system/boot/loader/menu.cpp index 0c75e69bdd..e39a23f470 100644 --- a/src/system/boot/loader/menu.cpp +++ b/src/system/boot/loader/menu.cpp @@ -288,7 +288,7 @@ Menu::AddItem(MenuItem *item) status_t Menu::AddSeparatorItem() { - MenuItem *item = new MenuItem(); + MenuItem *item = new(nothrow) MenuItem(); if (item == NULL) return B_NO_MEMORY; @@ -368,7 +368,7 @@ user_menu_boot_volume(Menu *menu, MenuItem *item) static Menu * add_boot_volume_menu(Directory *bootVolume) { - Menu *menu = new Menu(CHOICE_MENU, "Select Boot Volume"); + Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Boot Volume"); MenuItem *item; void *cookie; int32 count = 0; @@ -382,7 +382,7 @@ add_boot_volume_menu(Directory *bootVolume) char name[B_FILE_NAME_LENGTH]; if (volume->GetName(name, sizeof(name)) == B_OK) { - menu->AddItem(item = new MenuItem(name)); + menu->AddItem(item = new(nothrow) MenuItem(name)); item->SetTarget(user_menu_boot_volume); item->SetData(volume); @@ -399,20 +399,20 @@ add_boot_volume_menu(Directory *bootVolume) if (count == 0) { // no boot volume found yet - menu->AddItem(item = new MenuItem("")); + menu->AddItem(item = new(nothrow) MenuItem("")); item->SetType(MENU_ITEM_NO_CHOICE); item->SetEnabled(false); } menu->AddSeparatorItem(); - menu->AddItem(item = new MenuItem("Rescan volumes")); + menu->AddItem(item = new(nothrow) MenuItem("Rescan volumes")); item->SetHelpText("Please insert a Haiku CD-ROM or attach a USB disk - depending on your system, you can then boot from them."); item->SetType(MENU_ITEM_NO_CHOICE); if (count == 0) item->Select(true); - menu->AddItem(item = new MenuItem("Return to main menu")); + menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); item->SetType(MENU_ITEM_NO_CHOICE); if (gKernelArgs.boot_disk.booted_from_image) @@ -425,33 +425,33 @@ add_boot_volume_menu(Directory *bootVolume) static Menu * add_safe_mode_menu() { - Menu *safeMenu = new Menu(SAFE_MODE_MENU, "Safe Mode Options"); + Menu *safeMenu = new(nothrow) Menu(SAFE_MODE_MENU, "Safe Mode Options"); MenuItem *item; - safeMenu->AddItem(item = new MenuItem("Safe mode")); + safeMenu->AddItem(item = new(nothrow) MenuItem("Safe mode")); item->SetData(B_SAFEMODE_SAFE_MODE); item->SetType(MENU_ITEM_MARKABLE); item->SetHelpText("Puts the system into safe mode. This can be enabled independently " "from the other options."); - safeMenu->AddItem(item = new MenuItem("Disable user add-ons")); + safeMenu->AddItem(item = new(nothrow) MenuItem("Disable user add-ons")); item->SetData(B_SAFEMODE_DISABLE_USER_ADD_ONS); item->SetType(MENU_ITEM_MARKABLE); item->SetHelpText("Prevent all user installed add-ons to be loaded. Only the add-ons " "in the system directory will be used."); - safeMenu->AddItem(item = new MenuItem("Disable IDE DMA")); + safeMenu->AddItem(item = new(nothrow) MenuItem("Disable IDE DMA")); item->SetData(B_SAFEMODE_DISABLE_IDE_DMA); item->SetType(MENU_ITEM_MARKABLE); platform_add_menus(safeMenu); - safeMenu->AddItem(item = new MenuItem("Enable on screen debug output")); + safeMenu->AddItem(item = new(nothrow) MenuItem("Enable on screen debug output")); item->SetData("debug_screen"); item->SetType(MENU_ITEM_MARKABLE); safeMenu->AddSeparatorItem(); - safeMenu->AddItem(item = new MenuItem("Return to main menu")); + safeMenu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); return safeMenu; } @@ -491,26 +491,26 @@ user_menu_reboot(Menu *menu, MenuItem *item) status_t user_menu(Directory **_bootVolume) { - Menu *menu = new Menu(MAIN_MENU); + Menu *menu = new(nothrow) Menu(MAIN_MENU); Menu *safeModeMenu; MenuItem *item; // Add boot volume - menu->AddItem(item = new MenuItem("Select boot volume", add_boot_volume_menu(*_bootVolume))); + menu->AddItem(item = new(nothrow) MenuItem("Select boot volume", add_boot_volume_menu(*_bootVolume))); // Add safe mode - menu->AddItem(item = new MenuItem("Select safe mode options", safeModeMenu = add_safe_mode_menu())); + menu->AddItem(item = new(nothrow) MenuItem("Select safe mode options", safeModeMenu = add_safe_mode_menu())); // Add platform dependent menus platform_add_menus(menu); menu->AddSeparatorItem(); if (*_bootVolume == NULL) { - menu->AddItem(item = new MenuItem("Reboot")); + menu->AddItem(item = new(nothrow) MenuItem("Reboot")); item->SetTarget(user_menu_reboot); } - menu->AddItem(item = new MenuItem("Continue booting")); + menu->AddItem(item = new(nothrow) MenuItem("Continue booting")); if (*_bootVolume == NULL) { item->SetEnabled(false); menu->ItemAt(0)->Select(true); diff --git a/src/system/boot/loader/vfs.cpp b/src/system/boot/loader/vfs.cpp index 3faf60e9a2..8b5145dd18 100644 --- a/src/system/boot/loader/vfs.cpp +++ b/src/system/boot/loader/vfs.cpp @@ -287,7 +287,7 @@ Descriptor::Release() status_t vfs_init(stage2_args *args) { - gRoot = new RootFileSystem(); + gRoot = new(nothrow) RootFileSystem(); if (gRoot == NULL) return B_NO_MEMORY; @@ -543,7 +543,7 @@ open_node(Node *node, int mode) TRACE(("could open node at %p\n", node)); - Descriptor *descriptor = new Descriptor(node, cookie); + Descriptor *descriptor = new(nothrow) Descriptor(node, cookie); if (descriptor == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/platform/bios_ia32/devices.cpp b/src/system/boot/platform/bios_ia32/devices.cpp index 5916ee4463..b0de718942 100644 --- a/src/system/boot/platform/bios_ia32/devices.cpp +++ b/src/system/boot/platform/bios_ia32/devices.cpp @@ -494,7 +494,7 @@ add_block_devices(NodeList *devicesList, bool identifierMissing) if (driveID == gBootDriveID) continue; - BIOSDrive *drive = new BIOSDrive(driveID); + BIOSDrive *drive = new(nothrow) BIOSDrive(driveID); if (drive->InitCheck() != B_OK) { dprintf("could not add drive %u\n", driveID); delete drive; @@ -741,7 +741,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) { TRACE(("boot drive ID: %x\n", gBootDriveID)); - BIOSDrive *drive = new BIOSDrive(gBootDriveID); + BIOSDrive *drive = new(nothrow) BIOSDrive(gBootDriveID); if (drive->InitCheck() != B_OK) { dprintf("no boot drive!\n"); return B_ERROR; diff --git a/src/system/boot/platform/bios_ia32/menu.cpp b/src/system/boot/platform/bios_ia32/menu.cpp index a13727bbd8..69a2ee2f4a 100644 --- a/src/system/boot/platform/bios_ia32/menu.cpp +++ b/src/system/boot/platform/bios_ia32/menu.cpp @@ -19,16 +19,16 @@ platform_add_menus(Menu *menu) switch (menu->Type()) { case MAIN_MENU: - menu->AddItem(item = new MenuItem("Select fail-safe video mode", video_mode_menu())); + menu->AddItem(item = new(nothrow) MenuItem("Select fail-safe video mode", video_mode_menu())); item->SetTarget(video_mode_hook); break; case SAFE_MODE_MENU: smp_add_safemode_menus(menu); - menu->AddItem(item = new MenuItem("Don't call the BIOS")); + menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS")); item->SetType(MENU_ITEM_MARKABLE); - menu->AddItem(item = new MenuItem("Disable APM")); + menu->AddItem(item = new(nothrow) MenuItem("Disable APM")); item->SetType(MENU_ITEM_MARKABLE); item->SetData("disable_apm"); item->SetHelpText("This overrides the APM setting in the kernel settings file"); diff --git a/src/system/boot/platform/bios_ia32/smp.cpp b/src/system/boot/platform/bios_ia32/smp.cpp index 909ffdc9d1..65834c3911 100644 --- a/src/system/boot/platform/bios_ia32/smp.cpp +++ b/src/system/boot/platform/bios_ia32/smp.cpp @@ -510,13 +510,13 @@ smp_add_safemode_menus(Menu *menu) // ToDo: this should work with dual CPUs with HT as well! if (gKernelArgs.num_cpus > 2 || !supports_hyper_threading()) { - menu->AddItem(item = new MenuItem("Disable SMP")); + menu->AddItem(item = new(nothrow) MenuItem("Disable SMP")); item->SetData(B_SAFEMODE_DISABLE_SMP); item->SetType(MENU_ITEM_MARKABLE); } if (supports_hyper_threading()) { - menu->AddItem(item = new MenuItem("Disable Hyper-Threading")); + menu->AddItem(item = new(nothrow) MenuItem("Disable Hyper-Threading")); item->SetData(B_SAFEMODE_DISABLE_HYPER_THREADING); item->SetType(MENU_ITEM_MARKABLE); } diff --git a/src/system/boot/platform/bios_ia32/video.cpp b/src/system/boot/platform/bios_ia32/video.cpp index ccd1cafd73..dd880b04da 100644 --- a/src/system/boot/platform/bios_ia32/video.cpp +++ b/src/system/boot/platform/bios_ia32/video.cpp @@ -412,29 +412,29 @@ video_mode_hook(Menu *menu, MenuItem *item) Menu * video_mode_menu() { - Menu *menu = new Menu(CHOICE_MENU, "Select Video Mode"); + Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode"); MenuItem *item; - menu->AddItem(item = new MenuItem("Default")); + menu->AddItem(item = new(nothrow) MenuItem("Default")); item->SetMarked(true); item->Select(true); item->SetHelpText("The Default video mode is the one currently configured in " "the system. If there is no mode configured yet, a viable mode will be chosen " "automatically."); - menu->AddItem(new MenuItem("Standard VGA")); + menu->AddItem(new(nothrow) MenuItem("Standard VGA")); video_mode *mode = NULL; while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { char label[64]; sprintf(label, "%ldx%ld %ld bit", mode->width, mode->height, mode->bits_per_pixel); - menu->AddItem(item = new MenuItem(label)); + menu->AddItem(item = new(nothrow) MenuItem(label)); item->SetData(mode); } menu->AddSeparatorItem(); - menu->AddItem(item = new MenuItem("Return to main menu")); + menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); item->SetType(MENU_ITEM_NO_CHOICE); return menu; diff --git a/src/system/boot/platform/openfirmware/devices.cpp b/src/system/boot/platform/openfirmware/devices.cpp index a00179ea8c..ecc6a2e363 100644 --- a/src/system/boot/platform/openfirmware/devices.cpp +++ b/src/system/boot/platform/openfirmware/devices.cpp @@ -77,7 +77,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) return B_ERROR; } - Handle *device = new Handle(handle); + Handle *device = new(nothrow) Handle(handle); if (device == NULL) return B_NO_MEMORY; @@ -174,7 +174,7 @@ platform_add_block_devices(stage2_args *args, NodeList *devicesList) continue; } - Handle *device = new Handle(handle); + Handle *device = new(nothrow) Handle(handle); printf("\t\t(could open device, handle = %p, node = %p)\n", (void *)handle, device); devicesList->Add(device); diff --git a/src/system/kernel/boot_item.cpp b/src/system/kernel/boot_item.cpp index d4a829969d..24b5625ae6 100644 --- a/src/system/kernel/boot_item.cpp +++ b/src/system/kernel/boot_item.cpp @@ -30,7 +30,7 @@ static ItemList sItemList; status_t add_boot_item(const char *name, void *data, size_t size) { - boot_item *item = new boot_item; + boot_item *item = new(nothrow) boot_item; if (item == NULL) return B_NO_MEMORY; diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 0d169c16b1..ee3009d123 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -298,7 +298,7 @@ block_cache::FreeBlock(cached_block *block) cached_block * block_cache::NewBlock(off_t blockNumber) { - cached_block *block = new cached_block; + cached_block *block = new(nothrow) cached_block; if (block == NULL) { FATAL(("could not allocate block!\n")); return NULL; @@ -679,7 +679,7 @@ cache_start_transaction(void *_cache) if (cache->last_transaction && cache->last_transaction->open) panic("last transaction (%ld) still open!\n", cache->last_transaction->id); - cache_transaction *transaction = new cache_transaction; + cache_transaction *transaction = new(nothrow) cache_transaction; if (transaction == NULL) return B_NO_MEMORY; @@ -841,7 +841,7 @@ cache_detach_sub_transaction(void *_cache, int32 id, return B_BAD_VALUE; // create a new transaction for the sub transaction - cache_transaction *newTransaction = new cache_transaction; + cache_transaction *newTransaction = new(nothrow) cache_transaction; if (transaction == NULL) return B_NO_MEMORY; @@ -1081,7 +1081,7 @@ block_cache_delete(void *_cache, bool allowWrites) extern "C" void * block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly) { - block_cache *cache = new block_cache(fd, numBlocks, blockSize, readOnly); + block_cache *cache = new(nothrow) block_cache(fd, numBlocks, blockSize, readOnly); if (cache == NULL) return NULL; diff --git a/src/system/kernel/device_manager/probe.cpp b/src/system/kernel/device_manager/probe.cpp index f59e54de62..4af052cd4b 100644 --- a/src/system/kernel/device_manager/probe.cpp +++ b/src/system/kernel/device_manager/probe.cpp @@ -180,7 +180,9 @@ next_entry: goto next_entry; if (S_ISDIR(stat.st_mode) && fRecursive) { - KPath *nextPath = new KPath(path); + KPath *nextPath = new(nothrow) KPath(path); + if (!nextPath) + return B_NO_MEMORY; if (fPaths.Push(nextPath) != B_OK) return B_NO_MEMORY; @@ -211,7 +213,9 @@ DirectoryIterator::Unset() void DirectoryIterator::AddPath(const char *basePath, const char *subPath) { - KPath *path = new KPath(basePath); + KPath *path = new(nothrow) KPath(basePath); + if (!path) + panic("out of memory"); if (subPath != NULL) path->Append(subPath); diff --git a/src/system/kernel/fs/devfs.cpp b/src/system/kernel/fs/devfs.cpp index 1039334f8b..4d9d90b594 100644 --- a/src/system/kernel/fs/devfs.cpp +++ b/src/system/kernel/fs/devfs.cpp @@ -866,8 +866,11 @@ publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, // every raw disk gets an I/O scheduler object attached // ToDo: the driver should ask for a scheduler (ie. using its devfs node attributes) - if (isDisk && !strcmp(node->name, "raw")) - node->stream.u.dev.scheduler = new IOScheduler(path, info); + if (isDisk && !strcmp(node->name, "raw")) { + node->stream.u.dev.scheduler = new(nothrow) IOScheduler(path, info); + if (!node->stream.u.dev.scheduler) + return B_NO_MEMORY; + } return status; }