r15098 - gnucash/trunk/src/gnome-utils - gnc_history_get_last() can return NULL.

Thomas Bushnell BSG tb at becket.net
Fri Nov 10 13:03:46 EST 2006


On Fri, 2006-11-10 at 11:18 -0500, Derek Atkins wrote:
> Per Bojsen <per.bojsen at comcast.net> writes:
> 
> > *** Regarding Re: r15098 - gnucash/trunk/src/gnome-utils -
> >     gnc_history_get_last() can return NULL.; Derek Atkins
> >     <warlord at MIT.EDU> adds:
> >
> > Derek> free() still doesn't check, but g_free() does.
> >
> > Actually at least on Linux, according to man 3 free:
> >
> >   If ptr is NULL, no operation is performed.
> 
> Yes, but Linux isn't the only OS we support.  Have you checked
> the man pages on *BSD, MacOS, Windows, Solaris, IRIX?  It's
> just not safe to assume that libc's free() will check for NULL
> and work properly if you pass it NULL.  g_free(), however,
> is known to be safe in all versions we care about.

It's not a Linux thing: it's an ANSI C thing.  I think all those
platforms use ANSI C compilers.

Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20061110/4b7d5744/attachment.bin 


More information about the gnucash-devel mailing list