aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2009-09-03 16:15:10 +0000
committerMatthew Hoops2009-09-03 16:15:10 +0000
commit05035fd8c34443276d885eac58f9444579d71326 (patch)
treecda4d7509e7d61ce371ab8c70b19fb282c085880 /engines
parent3d94d1fba9c2c285da5d876d0c6d28aec799e032 (diff)
downloadscummvm-rg350-05035fd8c34443276d885eac58f9444579d71326.tar.gz
scummvm-rg350-05035fd8c34443276d885eac58f9444579d71326.tar.bz2
scummvm-rg350-05035fd8c34443276d885eac58f9444579d71326.zip
Fix a new/free mismatch when creating a MemoryReadStream from a MemoryWriteStreamDynamic by changing MemoryWriteStreamDynamic to use malloc/free instead of new/delete[]. This could have affected ScummEngine_v4::prepareSavegame().
svn-id: r43918
Diffstat (limited to 'engines')
-rw-r--r--engines/m4/midi.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index 3f1da2a369..201d7d3f5f 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -47,7 +47,9 @@ MidiPlayer::~MidiPlayer() {
stopMusic();
close();
delete _parser;
- delete _midiData;
+
+ if (_midiData)
+ free(_midiData);
}
void MidiPlayer::setVolume(int volume) {
@@ -181,8 +183,11 @@ void MidiPlayer::stopMusic() {
if (_parser) {
_parser->unloadMusic();
}
- delete[] _midiData;
- _midiData = NULL;
+
+ if (_midiData) {
+ free(_midiData);
+ _midiData = NULL;
+ }
}
// This function will convert HMP music into type 1 SMF, which our SMF parser