[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: xserver: Cleaning up memory allocation functions and macros
From:       Daniel Stone <daniel () fooishbar ! org>
Date:       2007-04-30 21:50:24
Message-ID: 20070430215024.GJ21538 () fooishbar ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Mon, Apr 30, 2007 at 01:18:47PM -0700, Alan Coopersmith wrote:
> Egbert Eich wrote:
> > >   - free() can take NULL as argument, so it's not needed to test for 
> > NULL > before calling it.
> >
> >Maybe not on all implementations? If we use a wrapper or macro this
> >can be handled there. The default wrapper doesn't need to address this.
> 
> Digging out my ancient copy of the Annotated ANSI C Standard (C89), it 
> requires
> free(NULL) to be safe - "If ptr is a null pointer, no action occurs."

Likewise, the standard specifies realloc() to malloc() on NULL.

["signature.asc" (application/pgp-signature)]

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic