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

Derek Atkins warlord at MIT.EDU
Fri Nov 10 11:18:34 EST 2006


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.

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list