[Scummvm-git-logs] scummvm master -> 9dcb80f760af256a5e2d2552dd55a47cfaec9d74

dreammaster paulfgilbert at gmail.com
Sat May 9 01:46:33 UTC 2020


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:
bb405565b7 GRAPHICS: Fix memory overrun blitting from paletted surfaces
9dcb80f760 ULTIMA4: Fixing memory leaks


Commit: bb405565b7ca4f9f554071a40561b4d52c3dac15
    https://github.com/scummvm/scummvm/commit/bb405565b7ca4f9f554071a40561b4d52c3dac15
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-08T18:45:34-07:00

Commit Message:
GRAPHICS: Fix memory overrun blitting from paletted surfaces

Changed paths:
    graphics/managed_surface.cpp


diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index 93c0c0312b..d5d7f614c4 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -244,8 +244,7 @@ void ManagedSurface::blitFromInner(const Surface &src, const Common::Rect &srcRe
 			for (int x = 0; x < srcBounds.width(); ++x,
 					srcP += src.format.bytesPerPixel,
 					destP += format.bytesPerPixel) {
-				src.format.colorToARGB(src.format.bytesPerPixel == 2 ? *(const uint16 *)srcP : *(const uint32 *)srcP,
-					aSrc, rSrc, gSrc, bSrc);
+
 				if (src.format.bytesPerPixel == 1) {
 					// Get the palette color
 					const uint32 col = palette[*srcP];
@@ -255,8 +254,9 @@ void ManagedSurface::blitFromInner(const Surface &src, const Common::Rect &srcRe
 					aSrc = (col >> 24) & 0xff;
 				} else {
 					// Use the src's pixel format to split up the source pixel
-					format.colorToRGB(format.bytesPerPixel == 2 ? *(const uint16 *)destP : *(const uint32 *)destP,
-						rDest, gDest, bDest);
+					src.format.colorToARGB(src.format.bytesPerPixel == 2
+						? *(const uint16 *)srcP : *(const uint32 *)srcP,
+						aSrc, rSrc, gSrc, bSrc);
 				}
 
 				if (aSrc == 0) {


Commit: 9dcb80f760af256a5e2d2552dd55a47cfaec9d74
    https://github.com/scummvm/scummvm/commit/9dcb80f760af256a5e2d2552dd55a47cfaec9d74
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-08T18:45:34-07:00

Commit Message:
ULTIMA4: Fixing memory leaks

Changed paths:
    engines/ultima/ultima4/controllers/game_controller.cpp
    engines/ultima/ultima4/map/maploader.cpp
    engines/ultima/ultima4/map/tileset.cpp


diff --git a/engines/ultima/ultima4/controllers/game_controller.cpp b/engines/ultima/ultima4/controllers/game_controller.cpp
index b7ee10e243..363fe5e67e 100644
--- a/engines/ultima/ultima4/controllers/game_controller.cpp
+++ b/engines/ultima/ultima4/controllers/game_controller.cpp
@@ -80,8 +80,7 @@ void GameController::initScreenWithoutReloadingState() {
 void GameController::init() {
 	initScreen();
 
-	// initialize the global game context, conversation and game state variables
-	g_context = new Context();
+	// initialize the state of the global game context
 	g_context->_line = TEXT_AREA_H - 1;
 	g_context->_col = 0;
 	g_context->_stats = new StatsArea();
diff --git a/engines/ultima/ultima4/map/maploader.cpp b/engines/ultima/ultima4/map/maploader.cpp
index bf0ee92c7a..df157e2c6a 100644
--- a/engines/ultima/ultima4/map/maploader.cpp
+++ b/engines/ultima/ultima4/map/maploader.cpp
@@ -59,6 +59,10 @@ MapLoaders::MapLoaders() {
 }
 
 MapLoaders::~MapLoaders() {
+	// Free the loaders
+	for (iterator it = begin(); it != end(); ++it)
+		delete it->_value;
+
 	g_mapLoaders = nullptr;
 }
 
diff --git a/engines/ultima/ultima4/map/tileset.cpp b/engines/ultima/ultima4/map/tileset.cpp
index 53861b32cb..f71a768cf3 100644
--- a/engines/ultima/ultima4/map/tileset.cpp
+++ b/engines/ultima/ultima4/map/tileset.cpp
@@ -38,6 +38,10 @@ TileRules::TileRules() {
 }
 
 TileRules::~TileRules() {
+	// Delete the tile rules
+	for (iterator it = begin(); it != end(); ++it)
+		delete it->_value;
+
 	g_tileRules = nullptr;
 }
 




More information about the Scummvm-git-logs mailing list