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

Andreas Köhler andi5.py at gmx.net
Thu Nov 9 02:14:59 EST 2006


Hi,

Am Mittwoch, den 08.11.2006, 17:42 -0500 schrieb David Hampton:
> Author: hampton
> Date: 2006-11-08 17:42:48 -0500 (Wed, 08 Nov 2006)
> New Revision: 15098
> Trac: http://svn.gnucash.org/trac/changeset/15098
> 
> Modified:
>    gnucash/trunk/src/gnome-utils/gnc-file.c
> Log:
> gnc_history_get_last() can return NULL.
> 
> Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
> ===================================================================
> --- gnucash/trunk/src/gnome-utils/gnc-file.c	2006-11-08 21:06:59 UTC (rev 15097)
> +++ gnucash/trunk/src/gnome-utils/gnc-file.c	2006-11-08 22:42:48 UTC (rev 15098)
> @@ -839,7 +839,8 @@
>  
>    lastfile = gnc_history_get_last();
>    newfile = gnc_file_dialog (_("Open"), NULL, lastfile, GNC_FILE_DIALOG_OPEN);
> -  g_free(lastfile);
> +  if (lastfile)
> +    g_free(lastfile);
>    result = gnc_post_file_open (newfile);
>  
>    /* This dialogue can show up early in the startup process. If the

g_free can handle NULL pointers just fine, now we are double-checking
again. There is even a bug about these checks in gtk+:

http://bugzilla.gnome.org/show_bug.cgi?id=369666

I do not suggest to fix all of them in the source, but I will whenever I
am editing the surrounding code block anyway.

Or is there some reason for these checks?

-- andi5




More information about the gnucash-devel mailing list