[FFmpeg-devel] [PATCH 2/2] iocodec: add ico_read_close to fix leaking ico->images

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Nov 9 01:00:09 EET 2016


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/icodec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index becbc0f..1d8e383 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -199,6 +199,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
+static int ico_read_close(AVFormatContext * s)
+{
+    IcoDemuxContext *ico = s->priv_data;
+    av_freep(&ico->images);
+    return 0;
+}
+
 AVInputFormat ff_ico_demuxer = {
     .name           = "ico",
     .long_name      = NULL_IF_CONFIG_SMALL("Microsoft Windows ICO"),
@@ -206,5 +213,6 @@ AVInputFormat ff_ico_demuxer = {
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
+    .read_close     = ico_read_close,
     .flags          = AVFMT_NOTIMESTAMPS,
 };
-- 
2.10.2



More information about the ffmpeg-devel mailing list