[FFmpeg-soc] [soc]: r977 - jpeg2000/j2kdec.c

Michael Niedermayer michaelni at gmx.at
Sat Aug 18 23:29:48 CEST 2007


On Sat, Aug 18, 2007 at 10:46:16PM +0200, k.nowosad wrote:
> Author: k.nowosad
> Date: Sat Aug 18 22:46:16 2007
> New Revision: 977
> 
> Log:
> added missing malloc checks
> 
> 
> Modified:
>    jpeg2000/j2kdec.c
> 
> Modified: jpeg2000/j2kdec.c
> ==============================================================================
> --- jpeg2000/j2kdec.c	(original)
> +++ jpeg2000/j2kdec.c	Sat Aug 18 22:46:16 2007
> @@ -318,10 +318,15 @@ static int get_siz(J2kDecoderContext *s)
>      s->numYtiles = ff_j2k_ceildiv(s->Ysiz - s->YT0siz, s->YTsiz);
>  
>      s->tile = av_mallocz(s->numXtiles * s->numYtiles * sizeof(J2kTile));
> +    if (!s->tile)
> +        return -1;

ideally these should be AVERROR(ENOMEM)

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20070818/46560d43/attachment.pgp>


More information about the FFmpeg-soc mailing list