[FFmpeg-devel] [PATCH] alloc_picture needs to free buffer when it's not going to use it

Daniel Kristjansson danielk
Mon Jul 23 18:33:12 CEST 2007


On Sat, 2007-07-21 at 16:34 +0200, Michael Niedermayer wrote:
> Hi
> On Fri, Jul 20, 2007 at 07:18:48PM -0400, Daniel Kristjansson wrote:
> > On Fri, 2007-07-20 at 19:55 +0200, Michael Niedermayer wrote:  
> > > >          if(r<0 || !pic->age || !pic->type || !pic->data[0]){
> > > >              av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
> > > > +            if(r>=0)
> > > > +                s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
> > > >              return -1;
> > > >          }
> > > 
> > > this is wrong, the general assumtation is that a failing function did the
> > > needed cleanup already, we cannot assume that pic is even valid here
> > 
> > Fair enough.
> > 
> > > >  
> > > >          if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){
> > > >              av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
> > > > +            if(r>=0)
> > > > +                s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
> > > >              return -1;
> > > >          }
> > > r cannot by <0 here
> > 
> > Ok, I've attached a new version removing these two problems and another
> > redundant (r>=0) check.
> 
> looks ok if regression tests pass

"make test" doesn't complain, is that what you are talking about, or
is there something more extensive I should be doing? If so is there
a guide somewhere I can look at? My last patch was documentation only
and even that was some time ago..

-- Daniel





More information about the ffmpeg-devel mailing list