[FFmpeg-devel] [PATCH] lavf/img2dec: Fix memory leak
Hendrik Leppkes
h.leppkes at gmail.com
Tue Sep 29 12:22:10 CEST 2015
On Tue, Sep 29, 2015 at 12:14 PM, Przemysław Sobala
<przemyslaw.sobala at grupawp.pl> wrote:
> Fixes #4886
> ---
> libavformat/img2dec.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index 70f0b09..fcd2b76 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -444,8 +444,12 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
> }
>
> res = av_new_packet(pkt, size[0] + size[1] + size[2]);
> - if (res < 0)
> + if (res < 0) {
> + for (i = 0; i < 3; i++) {
> + avio_closep(&f[i]);
> + }
> return res;
> + }
> pkt->stream_index = 0;
> pkt->flags |= AV_PKT_FLAG_KEY;
> if (s->ts_from_file) {
> --
> 1.8.3.1
>
This needs a !s->is_pipe check, otherwise it shall not be closed.
More information about the ffmpeg-devel
mailing list