[Scummvm-cvs-logs] scummvm master -> a5864d992dc1d494c088e779e8300bdd438923f4

eriktorbjorn eriktorbjorn at telia.com
Sat Jul 13 23:01:44 CEST 2013


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:
a5864d992d DEVTOOLS: Fix unimportant memory/resource leaks


Commit: a5864d992dc1d494c088e779e8300bdd438923f4
    https://github.com/scummvm/scummvm/commit/a5864d992dc1d494c088e779e8300bdd438923f4
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-07-13T13:58:27-07:00

Commit Message:
DEVTOOLS: Fix unimportant memory/resource leaks

CID 1022283, 1022284, 1022285

Changed paths:
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/pak.cpp



diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index ca809e0..01cde62 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -2350,8 +2350,10 @@ bool createIDMap(PAKFile &out, const ExtractInformation *eI, const int *needList
 	for (const int *id = needList; *id != -1; ++id) {
 		WRITE_BE_UINT16(dst, *id); dst += 2;
 		const ExtractFilename *fDesc = getFilenameDesc(*id);
-		if (!fDesc)
+		if (!fDesc) {
+			delete[] map;
 			return false;
+		}
 		*dst++ = getTypeID(fDesc->type);
 		WRITE_BE_UINT32(dst, getFilename(eI, *id)); dst += 4;
 	}
@@ -2359,15 +2361,18 @@ bool createIDMap(PAKFile &out, const ExtractInformation *eI, const int *needList
 	char filename[12];
 	if (!getFilename(filename, eI, 0)) {
 		fprintf(stderr, "ERROR: Could not create ID map for game\n");
+		delete[] map;
 		return false;
 	}
 
 	out.removeFile(filename);
 	if (!out.addFile(filename, map, mapSize)) {
 		fprintf(stderr, "ERROR: Could not add ID map \"%s\" to kyra.dat\n", filename);
+		delete[] map;
 		return false;
 	}
 
+	delete[] map;
 	return true;
 }
 
diff --git a/devtools/create_kyradat/pak.cpp b/devtools/create_kyradat/pak.cpp
index 0203285..0d085f5 100644
--- a/devtools/create_kyradat/pak.cpp
+++ b/devtools/create_kyradat/pak.cpp
@@ -142,6 +142,7 @@ bool PAKFile::outputAllFiles() {
 			printf("OK\n");
 		} else {
 			printf("FAILED\n");
+			fclose(file);
 			return false;
 		}
 		fclose(file);
@@ -168,6 +169,7 @@ bool PAKFile::outputFileAs(const char *f, const char *fn) {
 		printf("OK\n");
 	} else {
 		printf("FAILED\n");
+		fclose(file);
 		return false;
 	}
 	fclose(file);






More information about the Scummvm-git-logs mailing list