summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-02-25 17:52:34 +0100
committerwm4 <wm4@mplayer2.org>2012-02-25 17:52:34 +0100
commit8a10f587fc03f5e6368aa3eea418774351dbf0ac (patch)
tree56f58471a4e066db76521e0caa85ce73af88d2da /sub
parentc8efb6d5665d3b455ea005da74c51f9e37b1132f (diff)
downloadmpv-8a10f587fc03f5e6368aa3eea418774351dbf0ac.tar.bz2
mpv-8a10f587fc03f5e6368aa3eea418774351dbf0ac.tar.xz
Fix minor memory leak from 2003
Diffstat (limited to 'sub')
-rw-r--r--sub/subreader.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sub/subreader.c b/sub/subreader.c
index f694f57a7c..ad4142d50a 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -1505,7 +1505,11 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
utf16--;
mpsub_multiplier = (uses_time ? 100.0 : 1.0);
- if (sub_format==SUB_INVALID) {mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");return NULL;}
+ if (sub_format==SUB_INVALID) {
+ mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");
+ free_stream(fd);
+ return NULL;
+ }
srp=sr+sub_format;
mp_msg(MSGT_SUBREADER, MSGL_V, "SUB: Detected subtitle file format: %s\n", srp->name);
@@ -1533,7 +1537,8 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
subcp_close();
sub_utf8=sub_utf8_prev;
#endif
- return NULL;
+ free_stream(fd);
+ return NULL;
}
#ifdef CONFIG_SORTSUB
@@ -1570,6 +1575,7 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
#endif
free(first);
free(alloced_sub);
+ free_stream(fd);
return NULL;
}
// Apply any post processing that needs recoding first