Skip to content

Commit

Permalink
Use non-throwing new operator.
Browse files Browse the repository at this point in the history
Use a non-throwing new operator when allocating huge amounts of memory.
  • Loading branch information
jriesmeier committed Mar 4, 2025
1 parent b5a0196 commit 8a8e43e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dcmimage/include/dcmtk/dcmimage/dicomot.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2016, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -88,7 +88,7 @@ class DiColorMonoTemplate
{
if (pixel != NULL)
{
this->Data = new T[this->Count];
this->Data = new (std::nothrow) T[this->Count];
if (this->Data != NULL)
{
const T *r = pixel[0];
Expand Down
4 changes: 2 additions & 2 deletions dcmimgle/include/dcmtk/dcmimgle/dimocpt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2010, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -82,7 +82,7 @@ class DiMonoCopyTemplate
{
if (pixel != NULL)
{
this->Data = new T[this->getCount()];
this->Data = new (std::nothrow) T[this->getCount()];
if (this->Data != NULL)
OFBitmanipTemplate<T>::copyMem(pixel, this->Data, this->getCount());
}
Expand Down
4 changes: 2 additions & 2 deletions dcmimgle/include/dcmtk/dcmimgle/dimoflt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2011, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -95,7 +95,7 @@ class DiMonoFlipTemplate
{
if (pixel != NULL)
{
this->Data = new T[this->getCount()];
this->Data = new (std::nothrow) T[this->getCount()];
if (this->Data != NULL)
{
if (horz && vert)
Expand Down
4 changes: 2 additions & 2 deletions dcmimgle/include/dcmtk/dcmimgle/dimorot.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2011, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -94,7 +94,7 @@ class DiMonoRotateTemplate
{
if (pixel != NULL)
{
this->Data = new T[DiMonoPixelTemplate<T>::getCount()];
this->Data = new (std::nothrow) T[DiMonoPixelTemplate<T>::getCount()];
if (this->Data != NULL)
{
if (degree == 90)
Expand Down
4 changes: 2 additions & 2 deletions dcmimgle/include/dcmtk/dcmimgle/dimosct.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2011, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -112,7 +112,7 @@ class DiMonoScaleTemplate
{
if (pixel != NULL)
{
this->Data = new T[this->getCount()];
this->Data = new (std::nothrow) T[this->getCount()];
if (this->Data != NULL)
{
const T value = OFstatic_cast(T, OFstatic_cast(double, DicomImageClass::maxval(bits)) *
Expand Down

0 comments on commit 8a8e43e

Please sign in to comment.