[Scummvm-cvs-logs] scummvm master -> abf26b0614581f2725f65621d0403255884a9cc2
eriktorbjorn
eriktorbjorn at telia.com
Fri Jun 17 05:58:40 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
abf26b0614 GRAPHICS: Fix Valgrind warning
Commit: abf26b0614581f2725f65621d0403255884a9cc2
https://github.com/scummvm/scummvm/commit/abf26b0614581f2725f65621d0403255884a9cc2
Author: eriktorbjorn (eriktorbjorn at users.sourceforge.net)
Date: 2011-06-16T20:56:23-07:00
Commit Message:
GRAPHICS: Fix Valgrind warning
The stream class uses free() to automatically dispose of the buffer
so it must be allocated with malloc(), not "new".
Changed paths:
graphics/png.cpp
diff --git a/graphics/png.cpp b/graphics/png.cpp
index c250433..a1cf266 100644
--- a/graphics/png.cpp
+++ b/graphics/png.cpp
@@ -236,7 +236,7 @@ bool PNG::read(Common::SeekableReadStream *str) {
case kChunkIDAT:
if (_compressedBufferSize == 0) {
_compressedBufferSize += chunkLength;
- _compressedBuffer = new byte[_compressedBufferSize];
+ _compressedBuffer = (byte *)malloc(_compressedBufferSize);
_stream->read(_compressedBuffer, chunkLength);
} else {
// Expand the buffer
@@ -244,8 +244,8 @@ bool PNG::read(Common::SeekableReadStream *str) {
_compressedBufferSize += chunkLength;
byte *tmp = new byte[prevSize];
memcpy(tmp, _compressedBuffer, prevSize);
- delete[] _compressedBuffer;
- _compressedBuffer = new byte[_compressedBufferSize];
+ free(_compressedBuffer);
+ _compressedBuffer = (byte *)malloc(_compressedBufferSize);
memcpy(_compressedBuffer, tmp, prevSize);
delete[] tmp;
_stream->read(_compressedBuffer + prevSize, chunkLength);
More information about the Scummvm-git-logs
mailing list