Tito wrote:
> Maybe this version could be more useful.....
>
> void xfree(void *ptr)
> {
>       /*       sets the pointer to NULL
>               after it has been freed.*/
>       void **pp = (void **)ptr;
>
>       if (*pp == NULL) return;
>
>       free(*pp);
>       *pp = NULL;
> }
>
>   
You only modify the argument of xfree, not the original pointer.

What you wanted to write is:

void xfree(void **pp)
{
        /*       sets the pointer to NULL after it has been freed.*/
        if (*pp == NULL) return;
        free(*pp);
        *pp = NULL;
}


Regards
Ralf Friedl
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to