X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fswfdec.c;h=9a0b27bd8c481aac74637b306961b8684d8e20ab;hb=2d8d554f15a7a27cfeca81467cc9341a86f784e2;hp=212157f54aeb907ea9786a62f2fef4d5fda3e87a;hpb=0ff76ca86e0ea4dcf2b392c45f5fac8e5576bb0d;p=ffmpeg diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 212157f54ae..9a0b27bd8c4 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -61,7 +61,7 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) } -static int swf_probe(AVProbeData *p) +static int swf_probe(const AVProbeData *p) { GetBitContext gb; int len, xmin, xmax, ymin, ymax; @@ -152,6 +152,8 @@ static int swf_read_header(AVFormatContext *s) swf->zpb->seekable = 0; if (inflateInit(&swf->zstream) != Z_OK) { av_log(s, AV_LOG_ERROR, "Unable to init zlib context\n"); + av_freep(&swf->zbuf_in); + av_freep(&swf->zbuf_out); return AVERROR(EINVAL); } pb = swf->zpb; @@ -397,7 +399,6 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) if (linesize * height > pkt->size) { res = AVERROR_INVALIDDATA; - av_packet_unref(pkt); goto bitmap_end; } @@ -487,7 +488,6 @@ bitmap_end_skip: if ((res = av_new_packet(pkt, len)) < 0) return res; if (avio_read(pb, pkt->data, 4) != 4) { - av_packet_unref(pkt); return AVERROR_INVALIDDATA; } if (AV_RB32(pkt->data) == 0xffd8ffd9 || @@ -504,7 +504,6 @@ bitmap_end_skip: } if (res != pkt->size) { if (res < 0) { - av_packet_unref(pkt); return res; } av_shrink_packet(pkt, res);