[FFmpeg-devel] [PATCH 15/21] avformat/ape: Fix memleaks upon read_header failure

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Mar 22 05:47:50 EET 2020


Several buffers allocated in the course of reading the header would leak
if an error happened after their allocation. Fix this by setting the
FF_INPUTFORMAT_HEADER_CLEANUP flag so that ape_read_close() will be called
to clean up in case of failure to read the header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/ape.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/ape.c b/libavformat/ape.c
index ed6752a415..81088bbc02 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -470,4 +470,5 @@ AVInputFormat ff_ape_demuxer = {
     .read_close     = ape_read_close,
     .read_seek      = ape_read_seek,
     .extensions     = "ape,apl,mac",
+    .flags_internal = FF_INPUTFORMAT_HEADER_CLEANUP,
 };
-- 
2.20.1



More information about the ffmpeg-devel mailing list