From 8bdaa6361e8a9b44efaabded670f2efbe0791eef Mon Sep 17 00:00:00 2001 From: mbkma Date: Wed, 26 Feb 2020 10:14:57 +0100 Subject: free variables --- src/math-history-entry.c | 5 +++-- src/math-history.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/math-history-entry.c b/src/math-history-entry.c index baf3a7c..6948eac 100644 --- a/src/math-history-entry.c +++ b/src/math-history-entry.c @@ -98,8 +98,8 @@ math_history_entry_insert_entry(MathHistoryEntry *history_entry, char *equation, builder = gtk_builder_new(); if(gtk_builder_add_from_resource (builder, UI_HISTORY_ENTRY_RESOURCE_PATH, &error) == 0) { - g_print("gtk_builder_add_from_resource FAILED\n"); - g_print("%s\n",error->message); + g_warning("Error loading history-entry UI: %s", error->message); + g_clear_error(&error); return; } grid = GET_WIDGET(builder, "grid"); @@ -113,6 +113,7 @@ math_history_entry_insert_entry(MathHistoryEntry *history_entry, char *equation, gtk_label_set_text(GTK_LABEL(history_entry->priv->equation_label), history_entry->priv->equation_string); gtk_label_set_text(GTK_LABEL(history_entry->priv->answer_label), final_answer); gtk_builder_connect_signals(builder, history_entry); + g_free(final_answer); } static void diff --git a/src/math-history.c b/src/math-history.c index 18b9bda..e350ef8 100644 --- a/src/math-history.c +++ b/src/math-history.c @@ -52,7 +52,7 @@ scroll_bottom_cb(MathHistory *history, gpointer data) static gboolean check_history(MathHistory *history, char *equation) -{ /* Checks if the last inserted calculation is the same as the current calculation to be inserted in history-history */ +{ /* Checks if the last inserted calculation is the same as the current calculation to be inserted in history */ if (history->priv->items_count >= 1 && g_strcmp0(equation, history->priv->prev_equation)==0) return TRUE; /* returns true if last entered equation is the same as the current equation */ else @@ -61,7 +61,7 @@ check_history(MathHistory *history, char *equation) void math_history_insert_entry (MathHistory *history, char *equation, MPNumber *answer, int number_base) -{ /* Inserts a new entry into the history-history listbox */ +{ /* Inserts a new entry into the history listbox */ history->priv->entry = math_history_entry_new(history->priv->equation); gboolean check = check_history (history, equation); history->priv->prev_equation = g_strdup(equation); -- cgit v1.2.1