[FFmpeg-devel] [PATCH] Fix memory leak while opening input JPG that doesn't exist
Reimar Döffinger
Reimar.Doeffinger
Tue Aug 10 19:12:14 CEST 2010
On Tue, Aug 10, 2010 at 07:50:06PM +0200, Michael Niedermayer wrote:
> On Wed, Jul 28, 2010 at 12:09:01PM +0200, Przemys?aw Sobala wrote:
> > Hello
> > I came across a memory leak while opening non-existing JPG file (local or
> > remote-404) for input. Below patch fixes it.
> >
> > --
> > Cheers
> > pszemus
> >
> >
> > Index: libavformat/utils.c
> > ===================================================================
> > --- libavformat/utils.c (wersja 24571)
> > +++ libavformat/utils.c (kopia robocza)
> > @@ -474,6 +474,7 @@
> > if (st) {
> > av_free(st->priv_data);
> > av_free(st->codec->extradata);
> > + av_free(st->codec);
> > }
> > av_free(st);
> > }
> >
>
> looks ok
As said in the bug report where this was discussed:
this is IMO very incomplete. Even if it works for JPEG,
it most likely will still leak memory (e.g. neither
index nor metadata is freed).
I am quite sure it should do everything that
av_close_input_stream does, except calling read_close.
More information about the ffmpeg-devel
mailing list