From f72b253b32f56258eb1a9460ec1b0b2dd52bb55b Mon Sep 17 00:00:00 2001 From: Monsta Date: Fri, 28 Nov 2014 19:15:46 +0300 Subject: fix another little memleak by making logic cleaner --- capplets/network/mate-network-properties.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/capplets/network/mate-network-properties.c b/capplets/network/mate-network-properties.c index d1eaa515..32cd6e7c 100644 --- a/capplets/network/mate-network-properties.c +++ b/capplets/network/mate-network-properties.c @@ -176,12 +176,13 @@ static void cb_add_url (GtkButton *button, gpointer data) { GtkBuilder *builder = GTK_BUILDER (data); - gchar *new_url = NULL; - new_url = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, "entry_url")))); - if (strlen (new_url) == 0) + const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, "entry_url"))); + if (entry_text == NULL || strlen (entry_text) == 0) { return; - ignore_hosts = g_slist_append(ignore_hosts, new_url); + } + + ignore_hosts = g_slist_append(ignore_hosts, g_strdup (entry_text)); populate_listmodel(GTK_LIST_STORE(model), ignore_hosts); gtk_entry_set_text(GTK_ENTRY (gtk_builder_get_object (builder, "entry_url")), ""); -- cgit v1.2.1