mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
6142e86b84
commit
f145bebcae
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue