From 305c74d5163c5e344a675d39ca2394a9e45bd2c2 Mon Sep 17 00:00:00 2001 From: Aaron Brashears Date: Fri, 2 Feb 2007 17:28:58 +0000 Subject: Result of svn merge -r57264:57370 svn+ssh://svn/svn/linden/branches/adroit.r40-68 into release. --- indra/llimage/llimagejpeg.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/llimage/llimagejpeg.cpp') diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index c75e449db5..b1ab279de7 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -335,7 +335,12 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) // Double the buffer size; S32 new_buffer_size = self->mOutputBufferSize * 2; U8* new_buffer = new U8[ new_buffer_size ]; - memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); + if (!new_buffer) + { + llerrs << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )" << llendl; + return FALSE; + } + memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); /* Flawfinder: ignore */ delete[] self->mOutputBuffer; self->mOutputBuffer = new_buffer; @@ -359,7 +364,7 @@ void LLImageJPEG::encodeTermDestination( j_compress_ptr cinfo ) S32 file_bytes = (S32)(self->mOutputBufferSize - cinfo->dest->free_in_buffer); self->allocateData(file_bytes); - memcpy( self->getData(), self->mOutputBuffer, file_bytes ); + memcpy( self->getData(), self->mOutputBuffer, file_bytes ); /* Flawfinder: ignore */ } // static @@ -416,7 +421,7 @@ void LLImageJPEG::errorEmitMessage( j_common_ptr cinfo, int msg_level ) void LLImageJPEG::errorOutputMessage( j_common_ptr cinfo ) { // Create the message - char buffer[JMSG_LENGTH_MAX]; + char buffer[JMSG_LENGTH_MAX]; /* Flawfinder: ignore */ (*cinfo->err->format_message) (cinfo, buffer); ((LLImageJPEG*) cinfo->client_data)->setLastError( buffer ); -- cgit v1.2.3