On Mon, 9 Dec 2013 12:48:20 +0100, Diego Biurrun <[email protected]> wrote:
> On Mon, Dec 09, 2013 at 12:22:20AM -0500, Sean McGovern wrote:
> > --- a/libavformat/oggdec.c
> > +++ b/libavformat/oggdec.c
> > @@ -60,9 +60,13 @@ static const struct ogg_codec * const ogg_codecs[] = {
> >  static int ogg_save(AVFormatContext *s)
> >  {
> >      struct ogg *ogg = s->priv_data;
> > +    int i, ret = 0;
> >      struct ogg_state *ost =
> >          av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * 
> > sizeof(*ogg->streams));
> > -    int i;
> > +
> > +    if (!ost)
> > +        return AVERROR(ENOMEM);
> > +
> >      ost->pos      = avio_tell(s->pb);
> >      ost->curidx   = ogg->curidx;
> >      ost->next     = ogg->state;
> > @@ -72,12 +76,20 @@ static int ogg_save(AVFormatContext *s)
> >      for (i = 0; i < ogg->nstreams; i++) {
> >          struct ogg_stream *os = ogg->streams + i;
> >          os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
> > +        if (!os->buf) {
> > +            ret = AVERROR(ENOMEM);
> > +            goto fail;
> > +        }
> >          memcpy(os->buf, ost->streams[i].buf, os->bufpos);
> >      }
> >  
> >      ogg->state = ost;
> >  
> >      return 0;
> > +            
> > +fail:
> > +    av_freep(&ost);
> 
> ost is a pointer, why are you taking its address?
> 

Stab. Read how av_freep() works.
The & must be there.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to