diff options
author | Paweł Kołodziejski | 2004-01-08 23:22:51 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-01-08 23:22:51 +0000 |
commit | 2bc4c1e9cd10bc5a42026f1e0450dd6d39276e09 (patch) | |
tree | d29863fb632da90504b621c4ea7d165295ae4e37 | |
parent | 67dff87a92e0358218763d6212a7dd18db1ccb3d (diff) | |
download | scummvm-rg350-2bc4c1e9cd10bc5a42026f1e0450dd6d39276e09.tar.gz scummvm-rg350-2bc4c1e9cd10bc5a42026f1e0450dd6d39276e09.tar.bz2 scummvm-rg350-2bc4c1e9cd10bc5a42026f1e0450dd6d39276e09.zip |
moved malloc and free
svn-id: r12269
-rw-r--r-- | scumm/imuse_digi/dimuse_bndmgr.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scumm/imuse_digi/dimuse_bndmgr.cpp b/scumm/imuse_digi/dimuse_bndmgr.cpp index f477892c14..22c64db4e3 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -207,12 +207,11 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, 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 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, _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 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, final_size += output_size; size -= output_size; assert(size >= 0); - free(comp_input); if (size == 0) break; skip = 0; |