aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/stream.h6
-rw-r--r--engines/m4/midi.cpp11
2 files changed, 11 insertions, 6 deletions
diff --git a/common/stream.h b/common/stream.h
index 86e8e71134..6b127e6086 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -649,13 +649,13 @@ private:
byte *old_data = _data;
_capacity = new_len + 32;
- _data = new byte[_capacity];
+ _data = (byte *)malloc(_capacity);
_ptr = _data + _pos;
if (old_data) {
// Copy old data
memcpy(_data, old_data, _size);
- delete[] old_data;
+ free(old_data);
}
_size = new_len;
@@ -665,7 +665,7 @@ public:
~MemoryWriteStreamDynamic() {
if (_disposeMemory)
- delete[] _data;
+ free(_data);
}
uint32 write(const void *dataPtr, uint32 dataSize) {
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