diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-06-25 16:56:40 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:11:43 +0200 |
commit | f145bebcaef14b421c1a849eeb6143bce62c7a0c (patch) | |
tree | 01d11de99671e621e12c9caf24db14cb905efa04 /m_option.c | |
parent | 6142e86b842ece14ab2652ab9f8b6f177fe998e5 (diff) | |
download | mpv-f145bebcaef14b421c1a849eeb6143bce62c7a0c.tar.bz2 mpv-f145bebcaef14b421c1a849eeb6143bce62c7a0c.tar.xz |
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
Diffstat (limited to 'm_option.c')
-rw-r--r-- | m_option.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |