[Scummvm-cvs-logs] SF.net SVN: scummvm:[44516] scummvm/trunk/engines/agi
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Oct 1 14:09:02 CEST 2009
Revision: 44516
http://scummvm.svn.sourceforge.net/scummvm/?rev=44516&view=rev
Author: thebluegr
Date: 2009-10-01 12:09:02 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Fixed some potential memory leaks, reported by salty-horse
Modified Paths:
--------------
scummvm/trunk/engines/agi/preagi_mickey.cpp
scummvm/trunk/engines/agi/preagi_winnie.cpp
Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp 2009-10-01 12:04:58 UTC (rev 44515)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp 2009-10-01 12:09:02 UTC (rev 44516)
@@ -210,8 +210,6 @@
}
void Mickey::printDesc(int iRoom) {
- char *buffer = (char *)malloc(256);
-
MSA_DAT_HEADER hdr;
char szFile[256] = {0};
@@ -223,6 +221,7 @@
if (!infile.open(szFile))
return;
+ char *buffer = (char *)malloc(256);
memset(buffer, 0, 256);
infile.seek(hdr.ofsDesc[iRoom - 1] + IDI_MSA_OFS_DAT, SEEK_SET);
@@ -234,7 +233,6 @@
}
bool Mickey::checkMenu() {
- char *buffer = new char[sizeof(MSA_MENU)];
MSA_MENU menu;
int iSel0, iSel1;
MSA_DAT_HEADER hdr;
@@ -245,6 +243,8 @@
readDatHdr(szFile, &hdr);
if (!infile.open(szFile))
return false;
+
+ char *buffer = new char[sizeof(MSA_MENU)];
infile.seek(hdr.ofsRoom[_game.iRoom - 1] + IDI_MSA_OFS_DAT, SEEK_SET);
infile.read((uint8 *)buffer, sizeof(MSA_MENU));
infile.close();
@@ -725,7 +725,6 @@
// Graphics
void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) {
- uint8* buffer = new uint8[4096];
char szFile[255] = {0};
sprintf(szFile, IDS_MSA_PATH_OBJ, IDS_MSA_NAME_OBJ[iObj]);
@@ -733,6 +732,7 @@
if (!file.open(szFile))
return;
+ uint8* buffer = new uint8[4096];
uint32 size = file.size();
file.read(buffer, size);
file.close();
@@ -747,7 +747,6 @@
}
void Mickey::drawPic(int iPic) {
- uint8* buffer = new uint8[4096];
char szFile[255] = {0};
sprintf(szFile, IDS_MSA_PATH_PIC, iPic);
@@ -755,6 +754,7 @@
if (!file.open(szFile))
return;
+ uint8* buffer = new uint8[4096];
uint32 size = file.size();
file.read(buffer, size);
file.close();
Modified: scummvm/trunk/engines/agi/preagi_winnie.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.cpp 2009-10-01 12:04:58 UTC (rev 44515)
+++ scummvm/trunk/engines/agi/preagi_winnie.cpp 2009-10-01 12:09:02 UTC (rev 44516)
@@ -1053,7 +1053,6 @@
void Winnie::drawPic(const char *szName) {
char szFile[256] = {0};
Common::File file;
- uint8 *buffer = (uint8 *)malloc(4096);
// construct filename
if (_vm->getPlatform() != Common::kPlatformAmiga)
@@ -1065,6 +1064,7 @@
return;
}
+ uint8 *buffer = (uint8 *)malloc(4096);
uint32 size = file.size();
file.read(buffer, size);
file.close();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list