From 3b401fb07f04dd1947402550db6702619bbcb5ce Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 28 Apr 2011 01:06:16 +0300 Subject: 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. --- sub/find_subfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sub') 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); -- cgit v1.2.3