summaryrefslogtreecommitdiffstats
path: root/mplayer.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 /mplayer.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 'mplayer.c')
-rw-r--r--mplayer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mplayer.c b/mplayer.c
index 56d32cf63f..1ee07efc10 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1914,18 +1914,18 @@ if(sh_video) {
if(sub_auto) { // auto load sub file ...
char *psub = get_path( "sub/" );
char **tmp = sub_filenames((psub ? psub : ""), filename);
- char **tmp2 = tmp;
+ int i = 0;
free(psub); // release the buffer created by get_path() above
- while (*tmp2)
- add_subtitles (*tmp2++, sh_video->fps, 0);
+ while (tmp[i]) {
+ add_subtitles (tmp[i], sh_video->fps, 0);
+ free(tmp[i++]);
+ }
free(tmp);
if (set_of_sub_size == 0)
{
add_subtitles (mem_ptr=get_path("default.sub"), sh_video->fps, 1);
free(mem_ptr); // release the buffer created by get_path()
}
- if (set_of_sub_size > 0)
- add_subtitles (NULL, sh_video->fps, 1);
}
if (set_of_sub_size > 0) {
// setup global sub numbering