From 01812f083028b95a796a3e7ca89749bff62db7b3 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 29 Mar 2009 12:11:10 +0000 Subject: Fixed several free/delete mismatches. svn-id: r39736 --- engines/parallaction/disk_br.cpp | 6 +++--- engines/parallaction/disk_ns.cpp | 2 +- engines/parallaction/iff.cpp | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'engines/parallaction') diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 8558ed884f..30ef73b27b 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -513,7 +513,7 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, const char *filename) { // Overwrite the first color (transparent key) in the palette info.palette.setEntry(0, pal[0] >> 2, pal[1] >> 2, pal[2] >> 0); - free(pal); + delete []pal; // background data is drawn used the upper portion of the palette adjustForPalette(info.bg); @@ -595,7 +595,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { Common::String sName = name; Common::SeekableReadStream *stream = openFile("ras/" + sName, ".ras"); - ILBMDecoder decoder(stream); + ILBMDecoder decoder(stream, true); Graphics::Surface* surf = new Graphics::Surface; assert(surf); @@ -731,7 +731,7 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name, uint8 part) { debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects"); Common::SeekableReadStream *stream = openFile(name); - ILBMDecoder decoder(stream); + ILBMDecoder decoder(stream, true); uint16 max = objectsMax[part]; if (_vm->getFeatures() & GF_DEMO) diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 37104d7b0b..cf3fa681cc 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -1049,7 +1049,7 @@ void AmigaDisk_ns::loadMask(BackgroundInfo& info, const char *name) { b = pal[i*3+2]; info.layers[i] = (((r << 4) & 0xF00) | (g & 0xF0) | (b >> 4)) & 0xFF; } - delete pal; + delete []pal; info._mask = new MaskBuffer; info._mask->w = info.width; diff --git a/engines/parallaction/iff.cpp b/engines/parallaction/iff.cpp index 887157a38f..43dcac3697 100644 --- a/engines/parallaction/iff.cpp +++ b/engines/parallaction/iff.cpp @@ -123,7 +123,7 @@ Common::SeekableReadStream *IFFParser::getIFFBlockStream(Common::IFF_ID chunkNam // ILBM decoder implementation -ILBMDecoder::ILBMDecoder(Common::SeekableReadStream *in, bool disposeStream) : _in(in), _hasHeader(false), _bodySize((uint32)-1), _paletteSize((uint32)-1) { +ILBMDecoder::ILBMDecoder(Common::SeekableReadStream *in, bool disposeStream) : _in(in), _disposeStream(disposeStream), _hasHeader(false), _bodySize((uint32)-1), _paletteSize((uint32)-1) { assert(in); _parser.setInputStream(in); @@ -192,9 +192,8 @@ byte *ILBMDecoder::getBitmap(uint32 numPlanes, bool packPlanes) { Common::SeekableReadStream *bodyStream = _parser.getIFFBlockStream(ID_BODY); assert(bodyStream); - byte *bitmap = new byte[bitmapSize]; + byte *bitmap = (byte*)calloc(bitmapSize, 1); assert(bitmap); - memset(bitmap, 0, bitmapSize); switch (_header.pack) { case 1: { // PackBits compressed bitmap -- cgit v1.2.3