From 274a197a82f600835f3d2e2ed5a804e49a89e0c8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 29 Jun 2016 17:56:11 +0100 Subject: [PATCH] Moved assignment to within safe block --- src/osgPlugins/cfg/ConfigLexer.cpp | 3 +++ src/osgPlugins/zip/ZipArchive.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/cfg/ConfigLexer.cpp b/src/osgPlugins/cfg/ConfigLexer.cpp index e1d8f8a31..4e169efe4 100644 --- a/src/osgPlugins/cfg/ConfigLexer.cpp +++ b/src/osgPlugins/cfg/ConfigLexer.cpp @@ -1942,7 +1942,10 @@ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) + { YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + return 0; + } b->yy_buf_size = size; diff --git a/src/osgPlugins/zip/ZipArchive.cpp b/src/osgPlugins/zip/ZipArchive.cpp index 65631dbf4..9ff8c93f4 100644 --- a/src/osgPlugins/zip/ZipArchive.cpp +++ b/src/osgPlugins/zip/ZipArchive.cpp @@ -607,10 +607,10 @@ bool ZipArchive::CheckZipErrorCode(ZRESULT result) const { unsigned buf_size = 1025; char* buf = new (std::nothrow) char[buf_size]; - buf[buf_size - 1] = 0; - if (buf) { + buf[buf_size - 1] = 0; + FormatZipMessage(result, buf, buf_size - 1); //print error message