aboutsummaryrefslogtreecommitdiff
path: root/src/SFileListFile.cpp
diff options
context:
space:
mode:
authorLadislav <Zezula>2013-12-16 12:18:32 +0100
committerLadislav <Zezula>2013-12-16 12:18:32 +0100
commit60ef0346ba14b7153c9efd40d0aa6dd01d1d2671 (patch)
treeb065cfb6c3ee9cc47ac85dc6d435fe017e956d86 /src/SFileListFile.cpp
parentfe51da468be9ca0963192c5f3a1705562bc957ba (diff)
+ Fixed bugs in listfile search
Diffstat (limited to 'src/SFileListFile.cpp')
-rw-r--r--src/SFileListFile.cpp17
1 files changed, 4 insertions, 13 deletions
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)
{