summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-04-28 01:06:16 +0300
committerUoti Urpala <uau@mplayer2.org>2011-04-28 09:44:37 +0300
commit3b401fb07f04dd1947402550db6702619bbcb5ce (patch)
treeb3edb7fd1713885ec00b27cc33f865a1d18aea15 /sub
parent994b21a80a2f37b0d672526739cb742b87f33ad9 (diff)
downloadmpv-3b401fb07f04dd1947402550db6702619bbcb5ce.tar.bz2
mpv-3b401fb07f04dd1947402550db6702619bbcb5ce.tar.xz
find_subfiles: fix unintended modification of global filename
Commit a2d28010cc ("cleanup: find_subfiles.c: simplify (mainly using bstr)") was missing a bstrdup() in subtitle search code, and thus the code erroneously modified the original filename string passed in. As a result anything which printed or otherwise used the filename after that would use a lowercase-converted version instead of the actual file name. Fix by adding the bstrdup() to operate on a local copy of the name instead.
Diffstat (limited to 'sub')
-rw-r--r--sub/find_subfiles.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c
index 0de8bc4ca3..1e4b33d0cc 100644
--- a/sub/find_subfiles.c
+++ b/sub/find_subfiles.c
@@ -90,7 +90,7 @@ static void append_dir_subtitles(struct MPOpts *opts,
assert(strlen(fname) < 1e6);
struct bstr f_fname = BSTR(mp_basename(fname));
- struct bstr f_fname_noext = strip_ext(f_fname);
+ struct bstr f_fname_noext = bstrdup(tmpmem, strip_ext(f_fname));
bstr_lower(f_fname_noext);
struct bstr f_fname_trim = bstr_strip(f_fname_noext);