[FFmpeg-devel] [PATCH] Fix leak in mov.c
Baptiste Coudurier
baptiste.coudurier
Fri May 16 18:53:58 CEST 2008
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.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
More information about the ffmpeg-devel
mailing list