From 60ef0346ba14b7153c9efd40d0aa6dd01d1d2671 Mon Sep 17 00:00:00 2001 From: Ladislav Date: Mon, 16 Dec 2013 12:18:32 +0100 Subject: + Fixed bugs in listfile search --- src/SFileListFile.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/SFileListFile.cpp b/src/SFileListFile.cpp index c1197c9..058fc7a 100644 --- a/src/SFileListFile.cpp +++ b/src/SFileListFile.cpp @@ -53,14 +53,9 @@ static bool FreeListFileCache(TListFileCache * pCache) if(pCache == NULL) return false; - // - // Note: don't close the pCache->hFile handle. - // This has to be done by the creator of the listfile cache - // - - // Free all allocated buffers - if(pCache->szMask != NULL) - STORM_FREE(pCache->szMask); + // Close the listfile + if(pCache->hFile != NULL) + SFileCloseFile(pCache->hFile); STORM_FREE(pCache); return true; } @@ -82,7 +77,7 @@ static TListFileCache * CreateListFileCache(HANDLE hListFile, const char * szMas nMaskLength = strlen(szMask) + 1; // Allocate cache for one file block - pCache = (TListFileCache *)STORM_ALLOC(BYTE, sizeof(TListFileCache)); + pCache = (TListFileCache *)STORM_ALLOC(BYTE, sizeof(TListFileCache) + nMaskLength); if(pCache != NULL) { // Clear the entire structure @@ -596,10 +591,6 @@ HANDLE WINAPI SListFileFindFirstFile(HANDLE hMpq, const char * szListFile, const } } - // Close the listfile - if(hListFile != NULL) - SFileCloseFile(hListFile); - // Cleanup & exit if(nError != ERROR_SUCCESS) { -- cgit v1.2.3