[FFmpeg-cvslog] r11053 - trunk/libavformat/rmdec.c

Roberto Togni rxt
Mon Nov 19 21:32:55 CET 2007


On Mon, 19 Nov 2007 02:31:24 +0100
Michael Niedermayer <michaelni at gmx.at> wrote:

> On Sun, Nov 18, 2007 at 11:49:42PM +0100, rtogni wrote:
> > Author: rtogni
> > Date: Sun Nov 18 23:49:41 2007
> > New Revision: 11053
> > 
> > Log:
> > Check for memory allocation failure of temp buffer
> > 
> > 
> > Modified:
> >    trunk/libavformat/rmdec.c
> > 
> > Modified: trunk/libavformat/rmdec.c
> > ==============================================================================
> > --- trunk/libavformat/rmdec.c	(original)
> > +++ trunk/libavformat/rmdec.c	Sun Nov 18 23:49:41 2007
> > @@ -495,7 +495,8 @@ static int rm_assemble_video_frame(AVFor
> >      if((seq & 0x7F) == 1 || rm->curpic_num != pic_num){
> >          rm->slices = ((hdr & 0x3F) << 1) + 1;
> >          ssize = len2 + 8*rm->slices + 1;
> > -        rm->videobuf = av_realloc(rm->videobuf, ssize);
> > +        if(!(rm->videobuf = av_realloc(rm->videobuf, ssize)))
> > +            return AVERROR(ENOMEM);
> 
> looks like a memleak
> if realloc fails the original is not freed IIRC
> 

No idea about memleak, but since the buffer content does not need to be
preserved I just replaced it with free+malloc

Ciao,
 Roberto

-- 
Better is the enemy of good enough.




More information about the ffmpeg-cvslog mailing list