From a5ce4ef8277134c6c69e51e67fe6d9c889a87cb8 Mon Sep 17 00:00:00 2001 From: Scott Theisen Date: Thu, 10 Feb 2022 22:02:31 -0500 Subject: [PATCH] mpegts-mythtv.c: new_section_av_stream() fix memory leak revealed by preprocessing MACRO FF_ALLOCZ_OR_GOTO avformat_new_stream() allocates the returned AVStream. --- mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c b/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c index 685f0e7f895..781b2b3a47c 100644 --- a/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c +++ b/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c @@ -2614,13 +2614,12 @@ static void mpegts_cleanup_streams(MpegTSContext *ts) static AVStream *new_section_av_stream(SectionContext *sect, enum AVMediaType type, enum AVCodecID id) { - sect->st = av_mallocz(sizeof(AVStream)); - if (!(sect->st) && (sizeof(AVStream)) != 0) { + sect->st = avformat_new_stream(sect->stream, NULL); + if (!(sect->st)) { av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.\n"); return NULL; } - sect->st = avformat_new_stream(sect->stream, NULL); sect->st->id = sect->pid; avpriv_set_pts_info(sect->st, 33, 1, 90000);