From a2d3d3ae54ed643a6d04c4de3a91ec2ed77c3201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 13 Oct 2013 23:40:59 +0200 Subject: [PATCH] cdda: got rid of kernel_cpp.h - it should not be used. * It's "new" operator does not fail or throw on allocation problems, but just lets the constructor do its work (and likely crash because of accessing a null pointer). --- .../kernel/file_systems/cdda/kernel_interface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index bdc155881c..45bc7f1dea 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include "cdda.h" @@ -432,7 +431,7 @@ read_attributes(int fd, Inode* inode) size = B_BENDIAN_TO_HOST_INT32(size); name[length] = '\0'; - Attribute* attribute = new Attribute(name, type); + Attribute* attribute = new(std::nothrow) Attribute(name, type); if (attribute->IsProtectedNamespace()) { // Attributes in the protected namespace are handled internally // so we do not load them even if they are present in the @@ -853,7 +852,8 @@ Inode* Volume::_CreateNode(Inode* parent, const char* name, uint64 start, uint64 frames, int32 type) { - Inode* inode = new Inode(this, parent, name, start, frames, type); + Inode* inode = new(std::nothrow) Inode(this, parent, name, start, frames, + type); if (inode == NULL) return NULL; @@ -1276,7 +1276,7 @@ status_t Inode::AddAttribute(const char* name, type_code type, bool overwrite, const uint8* data, size_t length) { - Attribute* attribute = new Attribute(name, type); + Attribute* attribute = new(std::nothrow) Attribute(name, type); if (attribute == NULL) return B_NO_MEMORY; @@ -1476,7 +1476,7 @@ cdda_mount(fs_volume* fsVolume, const char* device, uint32 flags, { TRACE(("cdda_mount: entry\n")); - Volume* volume = new Volume(fsVolume); + Volume* volume = new(std::nothrow) Volume(fsVolume); if (volume == NULL) return B_NO_MEMORY;