avformat/mpegts: fix memory leak with merge_pmt_versions=1
Signed-off-by: Aman Gupta <aman@tmm1.net>
This commit is contained in:
@@ -247,6 +247,7 @@ typedef struct PESContext {
|
|||||||
uint8_t header[MAX_PES_HEADER_SIZE];
|
uint8_t header[MAX_PES_HEADER_SIZE];
|
||||||
AVBufferRef *buffer;
|
AVBufferRef *buffer;
|
||||||
SLConfigDescr sl;
|
SLConfigDescr sl;
|
||||||
|
int merged_st;
|
||||||
} PESContext;
|
} PESContext;
|
||||||
|
|
||||||
extern AVInputFormat ff_mpegts_demuxer;
|
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;
|
PESContext *pes = filter->u.pes_filter.opaque;
|
||||||
av_buffer_unref(&pes->buffer);
|
av_buffer_unref(&pes->buffer);
|
||||||
/* referenced private data will be freed later in
|
/* referenced private data will be freed later in
|
||||||
* avformat_close_input */
|
* avformat_close_input (pes->st->priv_data == pes) */
|
||||||
if (!((PESContext *)filter->u.pes_filter.opaque)->st) {
|
if (!pes->st || pes->merged_st) {
|
||||||
av_freep(&filter->u.pes_filter.opaque);
|
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) {
|
if (st) {
|
||||||
pes->st = st;
|
pes->st = st;
|
||||||
pes->stream_type = stream_type;
|
pes->stream_type = stream_type;
|
||||||
|
pes->merged_st = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pes->st) {
|
if (!pes->st) {
|
||||||
@@ -2211,6 +2213,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
|||||||
if (st) {
|
if (st) {
|
||||||
pes->st = st;
|
pes->st = st;
|
||||||
pes->stream_type = stream_type;
|
pes->stream_type = stream_type;
|
||||||
|
pes->merged_st = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pes && !pes->st) {
|
if (pes && !pes->st) {
|
||||||
|
Reference in New Issue
Block a user