aboutsummaryrefslogtreecommitdiff
path: root/common/stream.h
diff options
context:
space:
mode:
authorMatthew Hoops2009-09-03 16:15:10 +0000
committerMatthew Hoops2009-09-03 16:15:10 +0000
commit05035fd8c34443276d885eac58f9444579d71326 (patch)
treecda4d7509e7d61ce371ab8c70b19fb282c085880 /common/stream.h
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 'common/stream.h')
-rw-r--r--common/stream.h6
1 files changed, 3 insertions, 3 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) {