summaryrefslogtreecommitdiffstats
path: root/mencoder.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-01 09:01:41 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-01 09:01:41 +0000
commit46630a96a93494178f58f838337944313605966a (patch)
treefa70d7b94581bfaa4625dc67bc88d0518ce61003 /mencoder.c
parent0ff088813f7061d60f134874c0c3b8f170ebed4e (diff)
downloadmpv-46630a96a93494178f58f838337944313605966a.tar.bz2
mpv-46630a96a93494178f58f838337944313605966a.tar.xz
strdup subtitle filename at a more appropriate place, fixing memleaks and
double frees. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15604 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mencoder.c')
-rw-r--r--mencoder.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mencoder.c b/mencoder.c
index 6714d49114..70470cccfc 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -591,8 +591,17 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee
if(!subdata) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name[0]);
} else
if(sub_auto) { // auto load sub file ...
- subdata=sub_read_file( filename ? sub_filenames( get_path("sub/"), filename )[0]
- : "default.sub", sh_video->fps );
+ char **tmp = NULL;
+ int i = 0;
+ if (filename) {
+ char *psub = get_path( "sub/" );
+ tmp = sub_filenames((psub ? psub : ""), filename);
+ free(psub);
+ }
+ subdata=sub_read_file(tmp ? tmp[0] : "default.sub", sh_video->fps);
+ while (tmp && tmp[i])
+ free(tmp[i++]);
+ free(tmp);
}
#endif