summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-01-22 21:49:05 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-01-22 21:49:05 +0000
commit7b953c1763bc3c1d4f8c051efe160989235385ef (patch)
treeb26db530ae90ffa52ee5136b4325e5d3d44d005c
parent1e4f16a344ef975eec159a01ae5e902e5f75bcc1 (diff)
downloadmpv-7b953c1763bc3c1d4f8c051efe160989235385ef.tar.bz2
mpv-7b953c1763bc3c1d4f8c051efe160989235385ef.tar.xz
Fix a memory leak in the subreader.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30389 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--subreader.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/subreader.c b/subreader.c
index 953b491136..8682b6eadf 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1338,7 +1338,7 @@ const char* guess_cp(stream_t *st, const char *preferred_language, const char *f
sub_data* sub_read_file (char *filename, float fps) {
stream_t* fd;
int n_max, n_first, i, j, sub_first, sub_orig;
- subtitle *first, *second, *sub, *return_sub;
+ subtitle *first, *second, *sub, *return_sub, *alloced_sub = NULL;
sub_data *subt_data;
int uses_time = 0, sub_num = 0, sub_errs = 0;
struct subreader sr[]=
@@ -1401,6 +1401,7 @@ sub_data* sub_read_file (char *filename, float fps) {
}
#ifdef CONFIG_SORTSUB
+ alloced_sub =
sub = malloc(sizeof(subtitle));
//This is to deal with those formats (AQT & Subrip) which define the end of a subtitle
//as the beginning of the following
@@ -1429,6 +1430,7 @@ sub_data* sub_read_file (char *filename, float fps) {
subcp_close();
#endif
if ( first ) free(first);
+ free(alloced_sub);
return NULL;
}
// Apply any post processing that needs recoding first
@@ -1481,6 +1483,7 @@ sub_data* sub_read_file (char *filename, float fps) {
#ifdef CONFIG_ICONV
subcp_close();
#endif
+ free(alloced_sub);
// printf ("SUB: Subtitle format %s time.\n", uses_time?"uses":"doesn't use");
mp_msg(MSGT_SUBREADER, MSGL_V,"SUB: Read %i subtitles, %i bad line(s).\n",