Mercurial > mplayer.hg
changeset 30347:2f4948cd9a2a
Fix a memory leak in the subreader.
author | reimar |
---|---|
date | Fri, 22 Jan 2010 21:49:05 +0000 |
parents | a88a4507e2cf |
children | afbbefa368ee |
files | subreader.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/subreader.c Fri Jan 22 21:16:54 2010 +0000 +++ b/subreader.c Fri Jan 22 21:49:05 2010 +0000 @@ -1338,7 +1338,7 @@ 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 @@ } #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 @@ subcp_close(); #endif if ( first ) free(first); + free(alloced_sub); return NULL; } // Apply any post processing that needs recoding first @@ -1481,6 +1483,7 @@ #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",