aboutsummaryrefslogtreecommitdiff
path: root/audio/decoders
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-15 12:26:15 +0200
committerEugene Sandulenko2016-05-15 12:26:15 +0200
commit33184e822dfdbc083c472cba5e1bf4f0f9a25243 (patch)
treea3c5ff1085614820d0ea569741c20cc778bce5e8 /audio/decoders
parent384e45424e4b6a0ad9d8bd3dc8cb0b82c591be1d (diff)
downloadscummvm-rg350-33184e822dfdbc083c472cba5e1bf4f0f9a25243.tar.gz
scummvm-rg350-33184e822dfdbc083c472cba5e1bf4f0f9a25243.tar.bz2
scummvm-rg350-33184e822dfdbc083c472cba5e1bf4f0f9a25243.zip
AUDIO: Plug potential memory leak
Diffstat (limited to 'audio/decoders')
-rw-r--r--audio/decoders/aiff.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/audio/decoders/aiff.cpp b/audio/decoders/aiff.cpp
index e1949ebb07..253b36dec0 100644
--- a/audio/decoders/aiff.cpp
+++ b/audio/decoders/aiff.cpp
@@ -129,6 +129,8 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
foundSSND = true;
/* uint32 offset = */ stream->readUint32BE();
/* uint32 blockAlign = */ stream->readUint32BE();
+ if (dataStream)
+ delete dataStream;
dataStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + length - 8, disposeAfterUse);
break;
case MKTAG('F', 'V', 'E', 'R'):
@@ -154,7 +156,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
return 0;
default:
debug(1, "Skipping AIFF '%s' chunk", tag2str(tag));
- break;
+ break;
}
stream->seek(pos + length + (length & 1)); // ensure we're also word-aligned
@@ -203,7 +205,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
if (codec == MKTAG('s', 'o', 'w', 't'))
rawFlags |= Audio::FLAG_LITTLE_ENDIAN;
- return makeRawStream(dataStream, rate, rawFlags);
+ return makeRawStream(dataStream, rate, rawFlags);
}
case MKTAG('i', 'm', 'a', '4'):
// TODO: Use QT IMA ADPCM
@@ -212,7 +214,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
case MKTAG('Q', 'D', 'M', '2'):
// TODO: Need to figure out how to integrate this
// (But hopefully never needed)
- warning("Unhandled AIFF-C QDM2 compression");
+ warning("Unhandled AIFF-C QDM2 compression");
break;
case MKTAG('A', 'D', 'P', '4'):
// ADP4 on 3DO