[Scummvm-git-logs] scummvm master -> 5951649b4dd6b4c720f80d5e82cfc734db504c44
sev-
sev at scummvm.org
Fri Dec 30 18:32:47 CET 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cc917882a6 FULLPIPE: Fix leaks in surface and bitmap usage.
5951649b4d Merge pull request #878 from jammm/master
Commit: cc917882a69a1d670b5e23d23a496bc2ad9da62b
https://github.com/scummvm/scummvm/commit/cc917882a69a1d670b5e23d23a496bc2ad9da62b
Author: Aaryaman Vasishta (jem456.vasishta at gmail.com)
Date: 2016-12-31T00:55:33+09:00
Commit Message:
FULLPIPE: Fix leaks in surface and bitmap usage.
Fixes part of bug #9654.
Changed paths:
engines/fullpipe/gfx.cpp
engines/fullpipe/gfx.h
engines/fullpipe/statics.cpp
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index ea07621..619f41d 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -479,7 +479,7 @@ void Picture::freePicture() {
if (_bitmap) {
if (testFlags() && !_field_54) {
freeData();
- //free(_bitmap);
+ free(_bitmap);
_bitmap = 0;
}
}
@@ -772,6 +772,7 @@ Bitmap::Bitmap() {
_flags = 0;
_surface = 0;
_flipping = Graphics::FLIP_NONE;
+ _copied_surface = false;
}
Bitmap::Bitmap(Bitmap *src) {
@@ -784,15 +785,16 @@ Bitmap::Bitmap(Bitmap *src) {
_height = src->_height;
_pixels = src->_pixels;
_surface = new Graphics::TransparentSurface(*src->_surface);
+ _copied_surface = true;
_flipping = src->_flipping;
}
Bitmap::~Bitmap() {
- if (_pixels)
- free(_pixels);
- _surface->free();
+ if (!_copied_surface)
+ _surface->free();
delete _surface;
+ _surface = 0;
_pixels = 0;
}
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 1b4b4d3..43c23b4 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -45,6 +45,7 @@ struct Bitmap {
int _flags;
Graphics::TransparentSurface *_surface;
int _flipping;
+ bool _copied_surface;
Bitmap();
Bitmap(Bitmap *src);
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index ece4f43..bc66ebf 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -552,6 +552,8 @@ void Movement::draw(bool flipFlag, int angle) {
} else {
bmp->putDib(x, y, (int32 *)_currDynamicPhase->_paletteData, _currDynamicPhase->_alpha);
}
+ //Prevent memory leak after new was used to create bmp in reverseImage()
+ delete bmp;
if (_currDynamicPhase->_rect->top) {
if (!_currDynamicPhase->_convertedBitmap) {
Commit: 5951649b4dd6b4c720f80d5e82cfc734db504c44
https://github.com/scummvm/scummvm/commit/5951649b4dd6b4c720f80d5e82cfc734db504c44
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-12-30T18:32:43+01:00
Commit Message:
Merge pull request #878 from jammm/master
FULLPIPE: Fix leaks in surface and bitmap usage.
Changed paths:
engines/fullpipe/gfx.cpp
engines/fullpipe/gfx.h
engines/fullpipe/statics.cpp
More information about the Scummvm-git-logs
mailing list