From f145bebcaef14b421c1a849eeb6143bce62c7a0c Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 25 Jun 2010 16:56:40 +0000 Subject: m_option.c: fix list termination with -*-pre options 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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31559 b3059339-0415-0410-9bf9-f77b7e298cf2 --- m_option.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'm_option.c') diff --git a/m_option.c b/m_option.c index 36e538f6f3..b74efb5570 100644 --- a/m_option.c +++ b/m_option.c @@ -531,10 +531,12 @@ static int str_list_add(char** add, int n,void* dst,int pre) { 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); -- cgit v1.2.3