aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/gfx.cpp10
-rw-r--r--engines/fullpipe/gfx.h1
-rw-r--r--engines/fullpipe/statics.cpp2
3 files changed, 9 insertions, 4 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index ea07621cd4..619f41d6da 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 1b4b4d3cef..43c23b49bc 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 ece4f43e9f..bc66ebf40b 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) {