close packs when clearing search path
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 22 May 2007 20:15:24 +0000 (20:15 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 22 May 2007 20:15:24 +0000 (20:15 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7340 d7cf8633-e32d-0410-b094-e92efae38249

fs.c

diff --git a/fs.c b/fs.c
index 6df0612..916bb96 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1079,12 +1079,18 @@ FS_ClearSearchPath
 */
 void FS_ClearSearchPath (void)
 {
+       // unload all packs and directory information, close all pack files
+       // (if a qfile is still reading a pack it won't be harmed because it used
+       //  dup() to get its own handle already)
        while (fs_searchpaths)
        {
                searchpath_t *search = fs_searchpaths;
                fs_searchpaths = search->next;
                if (search->pack)
                {
+                       // close the file
+                       close(search->pack->handle);
+                       // free any memory associated with it
                        if (search->pack->files)
                                Mem_Free(search->pack->files);
                        Mem_Free(search->pack);