bfs: removed kernel_cpp.h's new operator.
* This fixes bug #9715 from the POV of BFS, ie. the new operator seems to call the constructor on a NULL object on failure.
This commit is contained in:
parent
c0f529c38b
commit
a1566b06b7
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2001-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de.
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
@ -206,7 +206,8 @@ InodeAllocator::New(block_run* parentRun, mode_t mode, block_run& run,
|
|||
}
|
||||
|
||||
run = fRun;
|
||||
fInode = new Inode(volume, *fTransaction, volume->ToVnode(run), mode, run);
|
||||
fInode = new(std::nothrow) Inode(volume, *fTransaction,
|
||||
volume->ToVnode(run), mode, run);
|
||||
if (fInode == NULL)
|
||||
RETURN_ERROR(B_NO_MEMORY);
|
||||
|
||||
|
@ -235,7 +236,8 @@ InodeAllocator::CreateTree()
|
|||
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
|
||||
fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX);
|
||||
|
||||
BPlusTree* tree = fInode->fTree = new BPlusTree(*fTransaction, fInode);
|
||||
BPlusTree* tree = fInode->fTree
|
||||
= new(std::nothrow) BPlusTree(*fTransaction, fInode);
|
||||
if (tree == NULL || tree->InitCheck() < B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
|
@ -347,7 +349,7 @@ Inode::Inode(Volume* volume, ino_t id)
|
|||
fOldLastModified = LastModified();
|
||||
|
||||
if (IsContainer())
|
||||
fTree = new BPlusTree(this);
|
||||
fTree = new(std::nothrow) BPlusTree(this);
|
||||
if (NeedsFileCache()) {
|
||||
SetFileCache(file_cache_create(fVolume->ID(), ID(), Size()));
|
||||
SetMap(file_map_create(volume->ID(), ID(), Size()));
|
||||
|
@ -2881,7 +2883,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
|
|||
|
||||
BPlusTree* tree = fAttributes->Tree();
|
||||
if (tree == NULL
|
||||
|| (fIterator = new TreeIterator(tree)) == NULL) {
|
||||
|| (fIterator = new(std::nothrow) TreeIterator(tree)) == NULL) {
|
||||
FATAL(("could not get tree in AttributeIterator::GetNext(ino_t"
|
||||
" = %" B_PRIdINO ",name = \"%s\")\n", fInode->ID(), name));
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
@ -2892,7 +2894,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
|
|||
ino_t id;
|
||||
status_t status = fIterator->GetNextEntry(name, &length,
|
||||
B_FILE_NAME_LENGTH, &id);
|
||||
if (status < B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
Vnode vnode(volume, id);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de.
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
@ -853,7 +853,7 @@ Journal::_WriteTransactionToLog()
|
|||
|
||||
free(vecs);
|
||||
|
||||
LogEntry* logEntry = new LogEntry(this, fVolume->LogEnd(),
|
||||
LogEntry* logEntry = new(std::nothrow) LogEntry(this, fVolume->LogEnd(),
|
||||
runArrays.LogEntryLength());
|
||||
if (logEntry == NULL) {
|
||||
FATAL(("no memory to allocate log entries!"));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
|
@ -971,7 +971,7 @@ Equation::PrepareQuery(Volume* /*volume*/, Index& index,
|
|||
if (tree == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
*iterator = new TreeIterator(tree);
|
||||
*iterator = new(std::nothrow) TreeIterator(tree);
|
||||
if (*iterator == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
@ -1249,11 +1249,11 @@ Term*
|
|||
Operator::Copy() const
|
||||
{
|
||||
if (fEquation != NULL) {
|
||||
Equation* equation = new Equation(*fEquation);
|
||||
Equation* equation = new(std::nothrow) Equation(*fEquation);
|
||||
if (equation == NULL)
|
||||
return NULL;
|
||||
|
||||
Term* term = new Term(equation);
|
||||
Term* term = new(std::nothrow) Term(equation);
|
||||
if (term == NULL)
|
||||
delete equation;
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ Operator::Copy() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Term* term = new Term(left, fOp, right);
|
||||
Term* term = new(std::nothrow) Term(left, fOp, right);
|
||||
if (term == NULL) {
|
||||
delete left;
|
||||
delete right;
|
||||
|
@ -1393,7 +1393,7 @@ Expression::ParseEquation(char** expr)
|
|||
return term;
|
||||
}
|
||||
|
||||
Equation* equation = new Equation(expr);
|
||||
Equation* equation = new(std::nothrow) Equation(expr);
|
||||
if (equation == NULL || equation->InitCheck() < B_OK) {
|
||||
delete equation;
|
||||
return NULL;
|
||||
|
@ -1413,8 +1413,8 @@ Expression::ParseAnd(char** expr)
|
|||
Term* right = ParseAnd(expr);
|
||||
Term* newParent = NULL;
|
||||
|
||||
if (right == NULL
|
||||
|| (newParent = new Operator(left, OP_AND, right)) == NULL) {
|
||||
if (right == NULL || (newParent = new(std::nothrow) Operator(left,
|
||||
OP_AND, right)) == NULL) {
|
||||
delete left;
|
||||
delete right;
|
||||
|
||||
|
@ -1438,8 +1438,8 @@ Expression::ParseOr(char** expr)
|
|||
Term* right = ParseAnd(expr);
|
||||
Term* newParent = NULL;
|
||||
|
||||
if (right == NULL
|
||||
|| (newParent = new Operator(left, OP_OR, right)) == NULL) {
|
||||
if (right == NULL || (newParent = new(std::nothrow) Operator(left,
|
||||
OP_OR, right)) == NULL) {
|
||||
delete left;
|
||||
delete right;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <AutoDeleter.h>
|
||||
#include <util/AutoLock.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
#include <util/kernel_cpp.h>
|
||||
#include <util/SinglyLinkedList.h>
|
||||
#include <util/Stack.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue