From 6ee17ffbe8d726bc0abdf71591012602c7d7a186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 24 Jun 2011 18:32:48 +0000 Subject: [PATCH] * Fixed incorrect usage of "new" - thanks korli! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42305 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/translation/BitmapStream.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/kits/translation/BitmapStream.cpp b/src/kits/translation/BitmapStream.cpp index 05a4b80e6b..5faf1c360b 100644 --- a/src/kits/translation/BitmapStream.cpp +++ b/src/kits/translation/BitmapStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku, Inc. + * Copyright 2002-2011, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -10,6 +10,8 @@ #include +#include + #include #include @@ -29,7 +31,11 @@ BBitmapStream::BBitmapStream(BBitmap* bitmap) fDetached = false; fPosition = 0; fSize = 0; - fBigEndianHeader = new TranslatorBitmap; + fBigEndianHeader = new (std::nothrow) TranslatorBitmap; + if (fBigEndianHeader == NULL) { + fBitmap = NULL; + return; + } // Extract header information if bitmap is available if (fBitmap != NULL && fBitmap->InitCheck() == B_OK) { @@ -168,7 +174,8 @@ BBitmapStream::WriteAt(off_t pos, const void* data, size_t size) if (fBitmap == NULL) { if (fHeader.bounds.left > 0.0 || fHeader.bounds.top > 0.0) DEBUGGER("non-origin bounds!"); - fBitmap = new BBitmap(fHeader.bounds, fHeader.colors); + fBitmap = new (std::nothrow )BBitmap(fHeader.bounds, + fHeader.colors); if (fBitmap == NULL) return B_ERROR; if (!fBitmap->IsValid()) {