icodec: add ico_read_close to fix leaking ico->images
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 8 Nov 2016 22:54:41 +0000 (23:54 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Wed, 9 Nov 2016 20:10:41 +0000 (21:10 +0100)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/icodec.c

index fa985fb..a0e126a 100644 (file)
@@ -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,
 };