Re: [AD] very very little small bug at config.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


In reply to xaviergonz@xxxxxxxxxx:
>      if (f) {
>     tmp = malloc(length+1);
>
>     if (tmp) {
>
>but since tmp is not initialized to NULL, it could lead that is an invalid
>filename is passed
>it will continue...

Nope, because if malloc() fails, it returns 0, which will be assigned to
tmp.

But I recommend always initialising local variables anyway, because you
might change the code to use the variables in a different way which
requires them to have a default value of 0.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/