Fixes for cppcheck reported issues

This commit is contained in:
Robert Osfield
2017-12-02 16:20:34 +00:00
parent 2366305e83
commit 59f841bc20
3 changed files with 6 additions and 18 deletions

View File

@@ -39,17 +39,6 @@ int __gl_memInit( size_t /*maxFast*/ )
{
#ifndef NO_MALLOPT
/* mallopt( M_MXFAST, maxFast );*/
#ifdef MEMORY_DEBUG
mallopt( M_DEBUG, 1 );
#endif
#endif
return 1;
}
#ifdef MEMORY_DEBUG
void *__gl_memAlloc( size_t n )
{
return memset( malloc( n ), 0xa5, n );
}
#endif

View File

@@ -41,14 +41,8 @@
#define memFree free
#define memInit __gl_memInit
/*extern void __gl_memInit( size_t );*/
extern int __gl_memInit( size_t );
#ifndef MEMORY_DEBUG
#define memAlloc malloc
#else
#define memAlloc __gl_memAlloc
extern void * __gl_memAlloc( size_t );
#endif
#endif

View File

@@ -709,7 +709,12 @@ osg::ref_ptr<osg::Image> InputStream::readImage(bool readFromExternal)
char* data = new char[size];
if ( !data )
throwException( "InputStream::readImage() Out of memory." );
if ( getException() ) return NULL;
if ( getException() )
{
delete [] data;
return NULL;
}
readCharArray( data, size );
image = new osg::Image;