[FFmpeg-devel] [PATCH] Fix leak in mov.c
Albert Astals Cid
aastals
Mon May 19 09:01:48 CEST 2008
El Friday 16 May 2008 18:53:58 Baptiste Coudurier va escriure:
> Hi,
>
> Albert Astals Cid wrote:
> > It seems that when errors happen mov_read_cmov is leaking both moov_data
> > and cmov_data.
> >
> > [...]
> >
> > Index: mov.c
> > ===================================================================
> > --- mov.c (revision 13180)
> > +++ mov.c (working copy)
> > @@ -1585,10 +1585,16 @@
> > return -1;
> > }
> > get_buffer(pb, cmov_data, cmov_len);
> > - if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef
> > *)cmov_data, cmov_len) != Z_OK) + if(uncompress (moov_data, (uLongf *)
> > &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) { +
> > av_free(moov_data);
> > + av_free(cmov_data);
> > return -1;
> > - if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL,
> > NULL) != 0) + }
> > + if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL,
> > NULL) != 0) { + av_free(moov_data);
> > + av_free(cmov_data);
> > return -1;
> > + }
> > atom.type = MKTAG('m','o','o','v');
> > atom.offset = 0;
> > atom.size = moov_len;
>
> This duplicates code, can you please use a "goto error;" which would
> avoid it ? Thanks.
Attached.
Albert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov.c.leak_patch
Type: text/x-diff
Size: 787 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080519/6051122e/attachment.diff>
More information about the ffmpeg-devel
mailing list