summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/mpegts.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c6fd3e1cef..f71f18a57d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -510,20 +510,22 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts,
{
MpegTSFilter *filter;
MpegTSSectionFilter *sec;
+ uint8_t *section_buf = av_mallocz(MAX_SECTION_SIZE);
- if (!(filter = mpegts_open_filter(ts, pid, MPEGTS_SECTION)))
+ if (!section_buf)
return NULL;
+
+ if (!(filter = mpegts_open_filter(ts, pid, MPEGTS_SECTION))) {
+ av_free(section_buf);
+ return NULL;
+ }
sec = &filter->u.section_filter;
sec->section_cb = section_cb;
sec->opaque = opaque;
- sec->section_buf = av_mallocz(MAX_SECTION_SIZE);
+ sec->section_buf = section_buf;
sec->check_crc = check_crc;
sec->last_ver = -1;
- if (!sec->section_buf) {
- av_free(filter);
- return NULL;
- }
return filter;
}