[Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_bndmgr.cpp,1.11,1.12

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Jan 8 15:23:02 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1:/tmp/cvs-serv5164

Modified Files:
	dimuse_bndmgr.cpp 
Log Message:
moved malloc and free

Index: dimuse_bndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_bndmgr.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dimuse_bndmgr.cpp	8 Jan 2004 23:17:54 -0000	1.11
+++ dimuse_bndmgr.cpp	8 Jan 2004 23:22:51 -0000	1.12
@@ -207,12 +207,11 @@
 	int skip = offset - (first_block * 0x2000) + header_size;
 
 	for (i = first_block; i <= last_block; i++) {
-		// CMI hack: one more zero byte at the end of input buffer
-		comp_input = (byte *)malloc(_compTable[i].size + 1);
-		comp_input[_compTable[i].size] = 0;
-
 		byte *curBuf;
 		if (_lastBlock != i) {
+			// CMI hack: one more zero byte at the end of input buffer
+			comp_input = (byte *)malloc(_compTable[i].size + 1);
+			comp_input[_compTable[i].size] = 0;
 			_file.seek(_bundleTable[index].offset + _compTable[i].offset, SEEK_SET);
 			_file.read(comp_input, _compTable[i].size);
 
@@ -222,6 +221,7 @@
 			_lastCacheOutputSize = output_size;
 			memcpy(_blockChache, comp_output, output_size);
 			curBuf = comp_output;
+			free(comp_input);
 		} else {
 			output_size = _lastCacheOutputSize;
 			curBuf = _blockChache;
@@ -237,7 +237,6 @@
 		final_size += output_size;
 		size -= output_size;
 		assert(size >= 0);
-		free(comp_input);
 		if (size == 0)
 			break;
 		skip = 0;





More information about the Scummvm-git-logs mailing list