[FFmpeg-devel] [PATCH] Fix memory leak while opening input JPG that doesn't exist

Reimar Döffinger Reimar.Doeffinger
Tue Aug 10 19:40:51 CEST 2010


On Tue, Aug 10, 2010 at 05:30:00PM +0000, Carl Eugen Hoyos wrote:
> Michael Niedermayer <michaelni <at> gmx.at> writes:
> 
> > > --- 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
> 
> I applied the patch since it definitely fixes the mem-leak described in issue
> 2126 (and I don't understand how the image2 demuxer can allocate chapter and
> index for non-existing files).

The image2 demuxer certainly is not the only demuxer that can fail.
Even if it wasn't possible to trigger it currently it would be a bug,
but my guess is that it is possible to craft a mov or mkv file where on open
the index will be read but the open function will still fail later on
during header parsing, thus causing a memleak.



More information about the ffmpeg-devel mailing list