[Scummvm-git-logs] scummvm master -> 733064565e1bc3b91a95dc7b9b2653938a5d1af7

sev- noreply at scummvm.org
Sun Nov 20 18:07:48 UTC 2022


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dcb401f3bf ICB: Fix output string firmat. CID 1433586
30e4c84ce7 AGI: Fix memory management with _propData. CID 1446667
733064565e GLK: SCOTT: Fix mismatched new[]/delete. CID 1488026, 1488033


Commit: dcb401f3bf08673494765612a601974d990857c6
    https://github.com/scummvm/scummvm/commit/dcb401f3bf08673494765612a601974d990857c6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-11-20T19:07:28+01:00

Commit Message:
ICB: Fix output string firmat. CID 1433586

Changed paths:
    engines/icb/options_manager_pc.cpp


diff --git a/engines/icb/options_manager_pc.cpp b/engines/icb/options_manager_pc.cpp
index 468a033c467..218f37725d7 100644
--- a/engines/icb/options_manager_pc.cpp
+++ b/engines/icb/options_manager_pc.cpp
@@ -548,7 +548,7 @@ void OptionsManager::MakeAllSurfii() {
 		// Create movie thumbnail surfii
 		for (i = 0; i < 24; i++) {
 			m_movieSurfaceIDs[i] = surface_manager->Create_new_surface(pxVString("MovieLib thumb %d", i), 100, 56, SYSTEM);
-			m_grayMovieSurfaceIDs[i] = surface_manager->Create_new_surface(pxVString("Gray MovieLib thumb", i), 100, 56, SYSTEM);
+			m_grayMovieSurfaceIDs[i] = surface_manager->Create_new_surface(pxVString("Gray MovieLib thumb %d", i), 100, 56, SYSTEM);
 		}
 	} else
 		Fatal_error("OptionsManager::MakeAllSurfii() function called when surface_manager is NULL");


Commit: 30e4c84ce78fff7790add6d8ac19a202a2034451
    https://github.com/scummvm/scummvm/commit/30e4c84ce78fff7790add6d8ac19a202a2034451
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-11-20T19:07:28+01:00

Commit Message:
AGI: Fix memory management with _propData. CID 1446667

Changed paths:
    engines/agi/wagparser.cpp


diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp
index 55aeb73a5ad..04c01fe5aa6 100644
--- a/engines/agi/wagparser.cpp
+++ b/engines/agi/wagparser.cpp
@@ -55,7 +55,7 @@ void WagProperty::deepCopy(const WagProperty &other) {
 	_propSize = other._propSize;
 
 	if (other._propData != nullptr) {
-		_propData = new char[other._propSize + 1UL]; // Allocate space for property's data plus trailing zero
+		_propData = (char *)calloc(other._propSize + 1UL, 1); // Allocate space for property's data plus trailing zero
 		memcpy(_propData, other._propData, other._propSize + 1UL); // Copy the whole thing
 	}
 }
@@ -73,7 +73,7 @@ bool WagProperty::read(Common::SeekableReadStream &stream) {
 	}
 
 	// Then read the property's data
-	_propData = new char[_propSize + 1UL]; // Allocate space for property's data plus trailing zero
+	_propData = (char *)calloc(_propSize + 1UL, 1); // Allocate space for property's data plus trailing zero
 	uint32 readBytes = stream.read(_propData, _propSize); // Read the data in
 	_propData[_propSize] = 0; // Set the trailing zero for easy C-style string access
 
@@ -97,7 +97,7 @@ void WagProperty::setDefaults() {
 
 void WagProperty::deleteData() {
 	if (_propData)
-		delete[] _propData;
+		free(_propData);
 	_propData = nullptr;
 }
 


Commit: 733064565e1bc3b91a95dc7b9b2653938a5d1af7
    https://github.com/scummvm/scummvm/commit/733064565e1bc3b91a95dc7b9b2653938a5d1af7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-11-20T19:07:28+01:00

Commit Message:
GLK: SCOTT: Fix mismatched new[]/delete. CID 1488026, 1488033

Changed paths:
    engines/glk/scott/decompress_z80.cpp


diff --git a/engines/glk/scott/decompress_z80.cpp b/engines/glk/scott/decompress_z80.cpp
index c9979d6f81b..c3f737097c4 100644
--- a/engines/glk/scott/decompress_z80.cpp
+++ b/engines/glk/scott/decompress_z80.cpp
@@ -657,7 +657,7 @@ static LibspectrumError readBlock(const uint8_t *buffer, LibspectrumSnap *snap,
 
 		libspectrumSplitTo48kPages(snap, uncompressed);
 
-		delete uncompressed;
+		delete[] uncompressed;
 
 	} else {
 
@@ -671,20 +671,20 @@ static LibspectrumError readBlock(const uint8_t *buffer, LibspectrumSnap *snap,
 		if (page <= 0 || page > 18) {
 			libspectrumPrintError(LIBSPECTRUM_ERROR_UNKNOWN);
 			warning("readBlock: unknown page %d", page);
-			delete uncompressed;
+			delete[] uncompressed;
 			return LIBSPECTRUM_ERROR_UNKNOWN;
 		}
 
 		/* If it's a ROM page, just throw it away */
 		if (page < 3) {
-			delete uncompressed;
+			delete[] uncompressed;
 			return LIBSPECTRUM_ERROR_NONE;
 		}
 
 		/* Page 11 is the Multiface ROM unless we're emulating something
 	   Scorpion-like */
 		if (page == 11 && !(capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_SCORP_MEMORY)) {
-			delete uncompressed;
+			delete[] uncompressed;
 			return LIBSPECTRUM_ERROR_NONE;
 		}
 
@@ -693,7 +693,7 @@ static LibspectrumError readBlock(const uint8_t *buffer, LibspectrumSnap *snap,
 		if (!(capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_128_MEMORY)) {
 			switch (page) {
 			case 3:
-				delete uncompressed;
+				delete[] uncompressed;
 				return LIBSPECTRUM_ERROR_NONE;
 			case 4:
 				page = 5;
@@ -710,7 +710,7 @@ static LibspectrumError readBlock(const uint8_t *buffer, LibspectrumSnap *snap,
 		if (libspectrumSnapPages(snap, page) == nullptr) {
 			libspectrumSnapSetPages(snap, page, uncompressed);
 		} else {
-			delete uncompressed;
+			delete[] uncompressed;
 			libspectrumPrintError(LIBSPECTRUM_ERROR_UNKNOWN);
 			warning("readBlock: page %d duplicated", page);
 			return LIBSPECTRUM_ERROR_CORRUPT;




More information about the Scummvm-git-logs mailing list