add: bitsRowData = NULL;
context: translate_from_tgamrle_to_bits(BPositionIO *inSource,	BPositionIO *outDestination, TGAColorMapSpec &mapspec,	TGAImageSpec &imagespec, uint8 *pmap){	status_t result = B_OK;		bool bvflip;	if (imagespec.descriptor & TGA_ORIGIN_VERT_BIT)		bvflip = false;	else		bvflip = true;	uint8 nalpha = 0;	switch (mapspec.entrysize) {		case 32:			nalpha = 8;			break;		case 16:			nalpha = 1;			break;		default:			nalpha = 0;			break;	}	int32 bitsRowBytes = imagespec.width * 4;	uint8 tgaPalBytesPerPixel = (mapspec.entrysize / 8) +		((mapspec.entrysize % 8) ? 1 : 0);	uint8 tgaBytesPerPixel = (imagespec.depth / 8) +		((imagespec.depth % 8) ? 1 : 0);	uint16 tgapixrow = 0, tgapixcol = 0;		// Setup outDestination so that it can be written to	// from the end of the file to the beginning instead of	// the other way around	off_t bitsFileSize = (bitsRowBytes * imagespec.height) + 		sizeof(TranslatorBitmap);	if (outDestination->SetSize(bitsFileSize) != B_OK)		// This call should work for BFile and BMallocIO objects,		// but may not work for other BPositionIO based types		return B_ERROR;	off_t bitsoffset = (imagespec.height - 1) * bitsRowBytes;	if (bvflip)		outDestination->Seek(bitsoffset, SEEK_CUR);		// allocate row buffers	uint8 *bitsRowData = new uint8[bitsRowBytes];	if (!bitsRowData)		return B_ERROR;	// perform the actual translation	memset(bitsRowData, 0xff, bitsRowBytes);	uint8 *pbitspixel = bitsRowData;	uint8 packethead;	StreamBuffer sbuf(inSource, TGA_STREAM_BUFFER_SIZE, true);	ssize_t rd = 0;	if (sbuf.InitCheck() == B_OK)		rd = sbuf.Read(&packethead, 1);	while (rd == 1) {		// Run Length Packet		if (packethead & TGA_RLE_PACKET_TYPE_BIT) {			uint8 tgaindex, rlecount;			rlecount = (packethead & ~TGA_RLE_PACKET_TYPE_BIT) + 1;			if (tgapixcol + rlecount > imagespec.width) {				result = B_NO_TRANSLATOR;				break;			}			rd = sbuf.Read(&tgaindex, 1);			if (rd == tgaBytesPerPixel) {				uint8 *ptgapixel;				ptgapixel = pmap + (tgaindex * tgaPalBytesPerPixel);								pix_tganm_to_bits(pbitspixel, ptgapixel, rlecount,					mapspec.entrysize, 0, nalpha);									pbitspixel += 4 * rlecount;				tgapixcol += rlecount;			} else {				result = B_NO_TRANSLATOR;				break; // error			}				// Raw Packet		} else {			uint8 tgaIndexBuf[128], rawcount;			rawcount = (packethead & ~TGA_RLE_PACKET_TYPE_BIT) + 1;			if (tgapixcol + rawcount > imagespec.width) {				result = B_NO_TRANSLATOR;				break;			}			rd = sbuf.Read(tgaIndexBuf, rawcount);			if (rd == rawcount) {				pix_tgam_to_bits(pbitspixel, tgaIndexBuf,					rawcount, mapspec.entrysize, pmap);				pbitspixel += 4 * rawcount;				tgapixcol += rawcount;			} else {				result = B_NO_TRANSLATOR;				break;			}		}				if (tgapixcol == imagespec.width) {			outDestination->Write(bitsRowData, bitsRowBytes);			tgapixcol = 0;			tgapixrow++;			if (tgapixrow == imagespec.height)				break;			if (bvflip)				outDestination->Seek(-(bitsRowBytes * 2), SEEK_CUR);			pbitspixel = bitsRowData;		}		rd = sbuf.Read(&packethead, 1);	}		delete[] bitsRowData;	return result;}