Fixed memory leak.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 16 Aug 2002 15:57:44 +0000
changeset 457 92e898299c7d
parent 456 ecaab6f9e19f
child 458 4eb9811905c0
Fixed memory leak.
archivers/qpak.c
--- a/archivers/qpak.c	Fri Aug 16 15:22:52 2002 +0000
+++ b/archivers/qpak.c	Fri Aug 16 15:57:44 2002 +0000
@@ -438,6 +438,9 @@
 
 static void qpak_deletePakInfo (QPAKinfo *pakInfo)
 {
+    if (pakInfo->handle != NULL)
+        __PHYSFS_platformClose(pakInfo->handle);
+
     if (pakInfo->filename != NULL)
         free(pakInfo->filename);
 
@@ -533,10 +536,7 @@
 
 static void QPAK_dirClose(DirHandle *dirHandle)
 {
-    QPAKinfo *info = (QPAKinfo *) dirHandle->opaque;
-    __PHYSFS_platformClose(info->handle);
-    free(info->filename);
-    free(info);
+    qpak_deletePakInfo((QPAKinfo *) dirHandle->opaque);
     free(dirHandle);
 } /* QPAK_dirClose */