From d337a90f7afab4c371f5faad0318e95cdd8f21ea Mon Sep 17 00:00:00 2001 From: Ewald Snel Date: Fri, 15 Nov 2002 16:28:35 +0000 Subject: Fix more memory leaks CVS patchset: 3265 CVS date: 2002/11/15 16:28:35 --- src/demuxers/demux_qt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index efaca1aa4..5551218d8 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.111 2002/11/15 04:30:17 tmmm Exp $ + * $Id: demux_qt.c,v 1.112 2002/11/15 16:28:35 esnel Exp $ * */ @@ -597,6 +597,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table, sample_table->sample_to_chunk_table = NULL; sample_table->time_to_sample_table = NULL; sample_table->decoder_config = NULL; + sample_table->frames = NULL; /* default type */ sample_table->type = MEDIA_OTHER; @@ -1560,8 +1561,10 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) { free(sample_tables[i].time_to_sample_table); free(sample_tables[i].sample_to_chunk_table); free(sample_tables[i].sync_sample_table); + free(sample_tables[i].frames); } free(sample_tables); + free(sample_table_indices); } static qt_error open_qt_file(qt_info *info, input_plugin_t *input) { @@ -1591,6 +1594,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) { /* seek to the start of moov atom */ if (input->seek(input, info->moov_first_offset, SEEK_SET) != info->moov_first_offset) { + free(moov_atom); info->last_error = QT_FILE_READ_ERROR; return info->last_error; } @@ -1611,6 +1615,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) { z_state.avail_out = BE_32(&moov_atom[0x24]); unzip_buffer = (unsigned char *)malloc(BE_32(&moov_atom[0x24])); if (!unzip_buffer) { + free(moov_atom); info->last_error = QT_NO_MEMORY; return info->last_error; } @@ -1622,18 +1627,24 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) { z_ret_code = inflateInit (&z_state); if (Z_OK != z_ret_code) { + free(unzip_buffer); + free(moov_atom); info->last_error = QT_ZLIB_ERROR; return info->last_error; } z_ret_code = inflate(&z_state, Z_NO_FLUSH); if ((z_ret_code != Z_OK) && (z_ret_code != Z_STREAM_END)) { + free(unzip_buffer); + free(moov_atom); info->last_error = QT_ZLIB_ERROR; return info->last_error; } z_ret_code = inflateEnd(&z_state); if (Z_OK != z_ret_code) { + free(unzip_buffer); + free(moov_atom); info->last_error = QT_ZLIB_ERROR; return info->last_error; } @@ -1655,6 +1666,8 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) { /* take apart the moov atom */ parse_moov_atom(info, moov_atom); + free(moov_atom); + return QT_OK; } -- cgit v1.2.3