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

Michael Niedermayer michaelni
Tue Jul 24 00:04:46 CEST 2007


Hi

On Mon, Jul 23, 2007 at 12:33:12PM -0400, Daniel Kristjansson wrote:
> 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..

regression tests == make test, yes

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070724/751cb61d/attachment.pgp>



More information about the ffmpeg-devel mailing list