diff mbox series

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

Message ID 20200322034756.29907-15-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/21] avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt March 22, 2020, 3:47 a.m. UTC
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@gmail.com>
---
 libavformat/ape.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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,
 };