Răsfoiți Sursa

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

Ryan C. Gordon 24 ani în urmă
părinte
comite
e6bebfa32c
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      platform/unix.c

+ 3 - 1
platform/unix.c

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