hi, i'm replying to here, please don't send mails directly to me, so that others can help, you too
Na Tue, Mar 27, 2007 at 02:07:59PM -0300, Cláudio Henrique <[EMAIL PROTECTED]>
pisal(a):
> in function data_new(void) from util.c:
> data_t *data_new(void)
> {
> data_t *data=NULL;
>
> data = (data_t*)malloc(sizeof(data_t));
> if(data==NULL)
> return(NULL);
> data->name=NULL;
> data->data=NULL;
> return(data);
> }
> what is the use of this test:
> if(data==NULL) return(NULL);
> ??
> it seems unused to me.
if malloc() fails, it'll return NULL. one should always check that case
otherwise the data->name=foo statement will segfault
VMiklos
--
developer of Frugalware Linux - http://frugalware.org
pgpI91nI4H00Z.pgp
Description: PGP signature
_______________________________________________ Frugalware-devel mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-devel
