[MPlayer-cvslog] r35309 - trunk/libmenu/menu_filesel.c

reimar subversion at mplayerhq.hu
Wed Oct 31 20:42:13 CET 2012


Author: reimar
Date: Wed Oct 31 20:42:13 2012
New Revision: 35309

Log:
Check value of n for validity before using it, not after.

Modified:
   trunk/libmenu/menu_filesel.c

Modified: trunk/libmenu/menu_filesel.c
==============================================================================
--- trunk/libmenu/menu_filesel.c	Wed Oct 31 20:08:19 2012	(r35308)
+++ trunk/libmenu/menu_filesel.c	Wed Oct 31 20:42:13 2012	(r35309)
@@ -313,12 +313,11 @@ bailout:
   free_extensions (extensions);
   closedir(dirp);
 
-  qsort(namelist, n, sizeof(char *), (kill_warn)compare);
-
   if (n < 0) {
     mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReaddirError,strerror(errno));
     return 0;
   }
+  qsort(namelist, n, sizeof(char *), (kill_warn)compare);
   while(n--) {
     if((e = calloc(1,sizeof(list_entry_t))) != NULL){
     e->p.next = NULL;


More information about the MPlayer-cvslog mailing list