From 65477c4c8456ceb7ee9d1e630421d4d5c79619dc Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 17 Aug 2016 09:37:48 +0200 Subject: Add std::nothrow so tests of memory allocation work as expected. Should eventually be replaced by smart pointers. (bzr r15062) --- src/io/gzipstream.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/io/gzipstream.cpp') diff --git a/src/io/gzipstream.cpp b/src/io/gzipstream.cpp index 380c42411..330191ecd 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -171,12 +171,12 @@ bool GzipInputStream::load() } srcLen = inputBuf.size(); - srcBuf = new Byte [srcLen]; + srcBuf = new (std::nothrow) Byte [srcLen]; if (!srcBuf) { return false; } - outputBuf = new unsigned char [OUT_SIZE]; + outputBuf = new (std::nothrow) unsigned char [OUT_SIZE]; if ( !outputBuf ) { delete[] srcBuf; srcBuf = NULL; @@ -386,14 +386,14 @@ void GzipOutputStream::flush() } uLong srclen = inputBuf.size(); - Bytef *srcbuf = new Bytef [srclen]; + Bytef *srcbuf = new (std::nothrow) Bytef [srclen]; if (!srcbuf) { return; } uLong destlen = srclen; - Bytef *destbuf = new Bytef [(destlen + (srclen/100) + 13)]; + Bytef *destbuf = new (std::nothrow) Bytef [(destlen + (srclen/100) + 13)]; if (!destbuf) { delete[] srcbuf; -- cgit v1.2.3