Correct memory leak found with Valgrind.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20735 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
J. Alex Aycinena 2011-06-04 03:37:38 +00:00
parent e6574c37e8
commit b3779bb878

View File

@ -119,8 +119,13 @@ update_report_list(GtkListStore *store, CustomReportDialog *crd)
in the gtkliststore */
for (i = 0; !scm_is_null(names); i++)
{
char * str;
name = scm_to_locale_string(scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F));
scm_dynwind_begin (0);
str = scm_to_locale_string (scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F));
name = g_strdup (str);
scm_dynwind_free (str);
scm_dynwind_end ();
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
@ -297,14 +302,20 @@ on_delete_custom_report_clicked(GtkWidget *button,
SCM template_menu_name = scm_c_eval_string("gnc:report-template-menu-name/report-guid");
SCM guid;
const gchar* report_name;
gchar* report_name;
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(crd->reportview));
guid = get_custom_report_selection(crd, _("You must select a report to delete."));
if (!scm_is_null(guid))
{
report_name = scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
char * str;
scm_dynwind_begin (0);
str = scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
report_name = g_strdup (str);
scm_dynwind_free (str);
scm_dynwind_end ();
/* we must confirm the user wants to delete their precious custom report! */
if (gnc_verify_dialog(crd->dialog, FALSE, "Are you sure you want to delete %s?", report_name))
@ -314,6 +325,7 @@ on_delete_custom_report_clicked(GtkWidget *button,
update_report_list(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(crd->reportview))),
crd);
}
g_free (report_name);
}
}