diff options
author | Aman Gupta <aman@tmm1.net> | 2018-05-21 12:13:06 -0700 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2018-05-21 12:16:06 -0700 |
commit | 70d25268c21cbee5f08304da95be1f647c630c15 (patch) | |
tree | 5875fd2acdd64d8ce3dd7149c57798a3159b9600 | |
parent | fc2daf36f926d393e7d27bc574adb9cb09b6c8db (diff) | |
download | ffmpeg-70d25268c21cbee5f08304da95be1f647c630c15.tar.gz |
avformat/mpegts: fix memory leak with merge_pmt_versions=1
Signed-off-by: Aman Gupta <aman@tmm1.net>
-rw-r--r-- | libavformat/mpegts.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index e39c927441..5f53f77d89 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -247,6 +247,7 @@ typedef struct PESContext { uint8_t header[MAX_PES_HEADER_SIZE]; AVBufferRef *buffer; SLConfigDescr sl; + int merged_st; } PESContext; extern AVInputFormat ff_mpegts_demuxer; @@ -550,8 +551,8 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter) PESContext *pes = filter->u.pes_filter.opaque; av_buffer_unref(&pes->buffer); /* referenced private data will be freed later in - * avformat_close_input */ - if (!((PESContext *)filter->u.pes_filter.opaque)->st) { + * avformat_close_input (pes->st->priv_data == pes) */ + if (!pes->st || pes->merged_st) { av_freep(&filter->u.pes_filter.opaque); } } @@ -2190,6 +2191,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (st) { pes->st = st; pes->stream_type = stream_type; + pes->merged_st = 1; } } if (!pes->st) { @@ -2211,6 +2213,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (st) { pes->st = st; pes->stream_type = stream_type; + pes->merged_st = 1; } } if (pes && !pes->st) { |