diff --git a/src/osgPlugins/tga/ReaderWriterTGA.cpp b/src/osgPlugins/tga/ReaderWriterTGA.cpp index 256beb603..861c61b70 100644 --- a/src/osgPlugins/tga/ReaderWriterTGA.cpp +++ b/src/osgPlugins/tga/ReaderWriterTGA.cpp @@ -405,6 +405,7 @@ int *numComponents_ret) break; default: tgaerror = ERR_UNSUPPORTED; + delete [] formattedMap; return NULL; /* unreachable code - (depth < 1 || depth > 4) rejected by "check for reasonable values in case this is not a tga file" near the start of this function*/ } @@ -415,8 +416,7 @@ int *numComponents_ret) dest += lineoffset; } - if (formattedMap) - delete[] formattedMap; + delete [] formattedMap; } break; case 2: /* RGB, uncompressed */