[Scummvm-cvs-logs] SF.net SVN: scummvm: [32636] scummvm/trunk/engines/drascula/drascula.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Jun 9 16:45:48 CEST 2008


Revision: 32636
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32636&view=rev
Author:   sev
Date:     2008-06-09 07:45:45 -0700 (Mon, 09 Jun 2008)

Log Message:
-----------
Properly initialize and free memory for texts

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-06-09 14:36:58 UTC (rev 32635)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-06-09 14:45:45 UTC (rev 32636)
@@ -957,8 +957,8 @@
 
 		res[lang] = (char **)malloc(sizeof(char *) * numTexts);
 
-		res[lang][0] = pos = (char *)malloc(entryLen);
-		res[lang][0] = pos = pos + DATAALIGNMENT;
+		pos = (char *)malloc(entryLen);
+		res[lang][0] = pos + DATAALIGNMENT;
 
 		in.read(res[lang][0], entryLen);
 
@@ -979,7 +979,7 @@
 
 void DrasculaEngine::freeTexts(char ***ptr) {
 	for (int lang = 0; lang < _numLangs; lang++) {
-		free(ptr[lang][0]);
+		free(ptr[lang][0] - DATAALIGNMENT);
 		free(ptr[lang]);
 	}
 	free(ptr);


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