Explorar o código

Fixed a potential free()ing of a NULL pointer in
__PHYSFS_platformEnumerateFiles.

Ryan C. Gordon %!s(int64=25) %!d(string=hai) anos
pai
achega
e6bebfa32c
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      platform/unix.c

+ 3 - 1
platform/unix.c

@@ -403,8 +403,10 @@ LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
         l->next = NULL;
     } /* while */
 
+    if (buf != NULL)
+        free(buf);
+
     closedir(dir);
-    free(buf);
     return(retval);
 } /* __PHYSFS_platformEnumerateFiles */