[MPlayer-cvslog] r31559 - trunk/m_option.c

reimar subversion at mplayerhq.hu
Fri Jun 25 18:56:41 CEST 2010


Author: reimar
Date: Fri Jun 25 18:56:40 2010
New Revision: 31559

Log:
Ensure that e.g. -af-pre will not cause the filter list to be
unterminated when the list was empty before.
Should fix bug #1687.

Modified:
   trunk/m_option.c

Modified: trunk/m_option.c
==============================================================================
--- trunk/m_option.c	Fri Jun 25 18:53:27 2010	(r31558)
+++ trunk/m_option.c	Fri Jun 25 18:56:40 2010	(r31559)
@@ -485,10 +485,12 @@ static int str_list_add(char** add, int 
   lst = realloc(lst,(n+ln+1)*sizeof(char*));
 
   if(pre) {
-    memmove(&lst[n],lst,(ln+1)*sizeof(char*));
+    memmove(&lst[n],lst,ln*sizeof(char*));
     memcpy(lst,add,n*sizeof(char*));
   } else
-    memcpy(&lst[ln],add,(n+1)*sizeof(char*));
+    memcpy(&lst[ln],add,n*sizeof(char*));
+  // (re-)add NULL-termination
+  lst[ln+n] = NULL;
 
   free(add);
 


More information about the MPlayer-cvslog mailing list