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:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2012, Axel Dörfler, [email protected].
|
* Copyright 2001-2013, Axel Dörfler, [email protected].
|
||||||
* This file may be used under the terms of the MIT License.
|
* 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;
|
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)
|
if (fInode == NULL)
|
||||||
RETURN_ERROR(B_NO_MEMORY);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
|
|
||||||
@@ -235,7 +236,8 @@ InodeAllocator::CreateTree()
|
|||||||
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
|
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
|
||||||
fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX);
|
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)
|
if (tree == NULL || tree->InitCheck() < B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@@ -347,7 +349,7 @@ Inode::Inode(Volume* volume, ino_t id)
|
|||||||
fOldLastModified = LastModified();
|
fOldLastModified = LastModified();
|
||||||
|
|
||||||
if (IsContainer())
|
if (IsContainer())
|
||||||
fTree = new BPlusTree(this);
|
fTree = new(std::nothrow) BPlusTree(this);
|
||||||
if (NeedsFileCache()) {
|
if (NeedsFileCache()) {
|
||||||
SetFileCache(file_cache_create(fVolume->ID(), ID(), Size()));
|
SetFileCache(file_cache_create(fVolume->ID(), ID(), Size()));
|
||||||
SetMap(file_map_create(volume->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();
|
BPlusTree* tree = fAttributes->Tree();
|
||||||
if (tree == NULL
|
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"
|
FATAL(("could not get tree in AttributeIterator::GetNext(ino_t"
|
||||||
" = %" B_PRIdINO ",name = \"%s\")\n", fInode->ID(), name));
|
" = %" B_PRIdINO ",name = \"%s\")\n", fInode->ID(), name));
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
@@ -2892,7 +2894,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
|
|||||||
ino_t id;
|
ino_t id;
|
||||||
status_t status = fIterator->GetNextEntry(name, &length,
|
status_t status = fIterator->GetNextEntry(name, &length,
|
||||||
B_FILE_NAME_LENGTH, &id);
|
B_FILE_NAME_LENGTH, &id);
|
||||||
if (status < B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
Vnode vnode(volume, id);
|
Vnode vnode(volume, id);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Axel Dörfler, [email protected].
|
* Copyright 2001-2013, Axel Dörfler, [email protected].
|
||||||
* This file may be used under the terms of the MIT License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -853,7 +853,7 @@ Journal::_WriteTransactionToLog()
|
|||||||
|
|
||||||
free(vecs);
|
free(vecs);
|
||||||
|
|
||||||
LogEntry* logEntry = new LogEntry(this, fVolume->LogEnd(),
|
LogEntry* logEntry = new(std::nothrow) LogEntry(this, fVolume->LogEnd(),
|
||||||
runArrays.LogEntryLength());
|
runArrays.LogEntryLength());
|
||||||
if (logEntry == NULL) {
|
if (logEntry == NULL) {
|
||||||
FATAL(("no memory to allocate log entries!"));
|
FATAL(("no memory to allocate log entries!"));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, Axel Dörfler, [email protected].
|
* Copyright 2001-2013, Axel Dörfler, [email protected].
|
||||||
* Copyright 2010, Clemens Zeidler <[email protected]>
|
* Copyright 2010, Clemens Zeidler <[email protected]>
|
||||||
* This file may be used under the terms of the MIT License.
|
* 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)
|
if (tree == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
*iterator = new TreeIterator(tree);
|
*iterator = new(std::nothrow) TreeIterator(tree);
|
||||||
if (*iterator == NULL)
|
if (*iterator == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -1249,11 +1249,11 @@ Term*
|
|||||||
Operator::Copy() const
|
Operator::Copy() const
|
||||||
{
|
{
|
||||||
if (fEquation != NULL) {
|
if (fEquation != NULL) {
|
||||||
Equation* equation = new Equation(*fEquation);
|
Equation* equation = new(std::nothrow) Equation(*fEquation);
|
||||||
if (equation == NULL)
|
if (equation == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Term* term = new Term(equation);
|
Term* term = new(std::nothrow) Term(equation);
|
||||||
if (term == NULL)
|
if (term == NULL)
|
||||||
delete equation;
|
delete equation;
|
||||||
|
|
||||||
@@ -1270,7 +1270,7 @@ Operator::Copy() const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Term* term = new Term(left, fOp, right);
|
Term* term = new(std::nothrow) Term(left, fOp, right);
|
||||||
if (term == NULL) {
|
if (term == NULL) {
|
||||||
delete left;
|
delete left;
|
||||||
delete right;
|
delete right;
|
||||||
@@ -1393,7 +1393,7 @@ Expression::ParseEquation(char** expr)
|
|||||||
return term;
|
return term;
|
||||||
}
|
}
|
||||||
|
|
||||||
Equation* equation = new Equation(expr);
|
Equation* equation = new(std::nothrow) Equation(expr);
|
||||||
if (equation == NULL || equation->InitCheck() < B_OK) {
|
if (equation == NULL || equation->InitCheck() < B_OK) {
|
||||||
delete equation;
|
delete equation;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1413,8 +1413,8 @@ Expression::ParseAnd(char** expr)
|
|||||||
Term* right = ParseAnd(expr);
|
Term* right = ParseAnd(expr);
|
||||||
Term* newParent = NULL;
|
Term* newParent = NULL;
|
||||||
|
|
||||||
if (right == NULL
|
if (right == NULL || (newParent = new(std::nothrow) Operator(left,
|
||||||
|| (newParent = new Operator(left, OP_AND, right)) == NULL) {
|
OP_AND, right)) == NULL) {
|
||||||
delete left;
|
delete left;
|
||||||
delete right;
|
delete right;
|
||||||
|
|
||||||
@@ -1438,8 +1438,8 @@ Expression::ParseOr(char** expr)
|
|||||||
Term* right = ParseAnd(expr);
|
Term* right = ParseAnd(expr);
|
||||||
Term* newParent = NULL;
|
Term* newParent = NULL;
|
||||||
|
|
||||||
if (right == NULL
|
if (right == NULL || (newParent = new(std::nothrow) Operator(left,
|
||||||
|| (newParent = new Operator(left, OP_OR, right)) == NULL) {
|
OP_OR, right)) == NULL) {
|
||||||
delete left;
|
delete left;
|
||||||
delete right;
|
delete right;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
#include <util/AutoLock.h>
|
#include <util/AutoLock.h>
|
||||||
#include <util/DoublyLinkedList.h>
|
#include <util/DoublyLinkedList.h>
|
||||||
#include <util/kernel_cpp.h>
|
|
||||||
#include <util/SinglyLinkedList.h>
|
#include <util/SinglyLinkedList.h>
|
||||||
#include <util/Stack.h>
|
#include <util/Stack.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user