[Scummvm-git-logs] scummvm master -> dcab7c8e55ce8b576ffe91922c845f83da198482

sluicebox noreply at scummvm.org
Sat Oct 19 15:50:35 UTC 2024


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:
dcab7c8e55 AGI: Fix memory leak in `loadExtendedDictionary`


Commit: dcab7c8e55ce8b576ffe91922c845f83da198482
    https://github.com/scummvm/scummvm/commit/dcab7c8e55ce8b576ffe91922c845f83da198482
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-19T09:50:05-06:00

Commit Message:
AGI: Fix memory leak in `loadExtendedDictionary`

CID 1475952

Changed paths:
    engines/agi/words.cpp


diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index df07b3cf6cb..b5ccf41faec 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -146,11 +146,14 @@ int Words::loadExtendedDictionary(const char *sierraFname) {
 	fp.readString('\n');
 
 	while (!fp.eos() && !fp.err()) {
-		WordEntry *newWord = new WordEntry;
-		newWord->word = fp.readString();
-		newWord->id = atoi(fp.readString('\n').c_str());
-		if (!newWord->word.empty())
+		Common::String word = fp.readString();
+		uint16 id = atoi(fp.readString('\n').c_str());
+		if (!word.empty()) {
+			WordEntry *newWord = new WordEntry();
+			newWord->word = word;
+			newWord->id = id;
 			_dictionaryWords[(byte)newWord->word[0] - 'a'].push_back(newWord);
+		}
 	}
 
 	return errOK;




More information about the Scummvm-git-logs mailing list