[Gnucash-changes] Eliminate a double free of memory.

Chris Shoemaker c.shoemaker at cox.net
Thu Jun 2 13:00:38 EDT 2005


On Thu, Jun 02, 2005 at 11:10:48AM -0400, David Hampton wrote:
> --- src/business/business-gnome/dialog-customer.c
> +++ src/business/business-gnome/dialog-customer.c
> @@ -383,7 +383,8 @@
>    CustomerWindow *cw = user_data;
>  
>    gtk_widget_destroy (cw->dialog);
> -  cw->dialog = NULL;
> +  // cw has already been freed by this point.
> +  // cw->dialog = NULL;
>  }

This patch looks wrong.  1) This certainly doesn't fix a double-free
bug because it doesn't remove a free.  2) gtk_widget_destroy() may
free cw->dialog, in which case it's wise to assign NULL.
gtk_widget_destroy should never free cw.  If it does, then something
is seriously wrong somewhere else, but not here.

-chris


More information about the gnucash-devel mailing list