Fixed Coverity Scan reported memory leaks

This commit is contained in:
Robert Osfield
2017-10-31 15:55:24 +00:00
parent 42c7d7ece1
commit 3459e8f4fd

View File

@@ -360,8 +360,14 @@ int *numComponents_ret)
{
case 1: /* colormap, uncompressed */
{
if (colormapLen == 0 || indexsize == 0) {
if (colormapLen == 0 || indexsize == 0)
{
tgaerror = ERR_UNSUPPORTED; /* colormap missing or empty */
if (colormap) delete [] colormap;
delete [] buffer;
delete [] linebuf;
return NULL;
}
unsigned char * formattedMap = new unsigned char[colormapLen * format];