[vlc-commits] filesystem: avoid potential qsort(NULL)

Rémi Denis-Courmont git at videolan.org
Mon Aug 25 20:35:48 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 25 21:35:27 2014 +0300| [558e6b78d4c269a2de4a152cd2c72cb685c65027] | committer: Rémi Denis-Courmont

filesystem: avoid potential qsort(NULL)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=558e6b78d4c269a2de4a152cd2c72cb685c65027
---

 src/text/filesystem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/text/filesystem.c b/src/text/filesystem.c
index 31d4dc6..4b4d0bb 100644
--- a/src/text/filesystem.c
+++ b/src/text/filesystem.c
@@ -153,7 +153,7 @@ int vlc_loaddir( DIR *dir, char ***namelist,
             num++;
     }
 
-    if (compar != NULL)
+    if (compar != NULL && num > 0)
         qsort (tab, num, sizeof (*tab),
                (int (*)( const void *, const void *))compar);
     *namelist = tab;



More information about the vlc-commits mailing list