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.
This commit is contained in:
Uoti Urpala 2011-04-28 01:06:16 +03:00
parent 994b21a80a
commit 3b401fb07f
1 changed files with 1 additions and 1 deletions

View File

@ -90,7 +90,7 @@ static void append_dir_subtitles(struct MPOpts *opts,
assert(strlen(fname) < 1e6); assert(strlen(fname) < 1e6);
struct bstr f_fname = BSTR(mp_basename(fname)); 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); bstr_lower(f_fname_noext);
struct bstr f_fname_trim = bstr_strip(f_fname_noext); struct bstr f_fname_trim = bstr_strip(f_fname_noext);