diff options
author | Milan Crha <mcrha@redhat.com> | 2012-05-31 16:44:49 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-05-31 16:44:49 +0800 |
commit | 71924fc48776c642fe8520febc384250cf55973c (patch) | |
tree | 6b2f1738675f111dfb664805f82ad27add135715 /plugins/templates/templates.c | |
parent | c88d3170304e1892b221d0581a3cd3c767de4281 (diff) | |
download | gsoc2013-evolution-71924fc48776c642fe8520febc384250cf55973c.tar.gz gsoc2013-evolution-71924fc48776c642fe8520febc384250cf55973c.tar.zst gsoc2013-evolution-71924fc48776c642fe8520febc384250cf55973c.zip |
Fix memory leaks around gtk_tree_model_get() function
Diffstat (limited to 'plugins/templates/templates.c')
-rw-r--r-- | plugins/templates/templates.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 75891641e2..4359af01b9 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -169,8 +169,10 @@ commit_changes (UIData *ui) gchar *keyword, *value; gchar *key; - gtk_tree_model_get (model, &iter, CLUE_KEYWORD_COLUMN, &keyword, -1); - gtk_tree_model_get (model, &iter, CLUE_VALUE_COLUMN, &value, -1); + gtk_tree_model_get (model, &iter, + CLUE_KEYWORD_COLUMN, &keyword, + CLUE_VALUE_COLUMN, &value, + -1); /* Check if the keyword and value are not empty */ if ((keyword) && (value) && (g_utf8_strlen (g_strstrip (keyword), -1) > 0) @@ -178,6 +180,10 @@ commit_changes (UIData *ui) key = g_strdup_printf("%s=%s", keyword, value); g_variant_builder_add (&b, "s", key); } + + g_free (keyword); + g_free (value); + valid = gtk_tree_model_iter_next (model, &iter); } @@ -260,6 +266,7 @@ key_cell_edited_callback (GtkCellRendererText *cell, gtk_tree_model_get (model, &iter, CLUE_VALUE_COLUMN, &value, -1); gtk_list_store_set (GTK_LIST_STORE (model), &iter, CLUE_KEYWORD_COLUMN, new_text, CLUE_VALUE_COLUMN, value, -1); + g_free (value); commit_changes (ui); } @@ -282,6 +289,7 @@ value_cell_edited_callback (GtkCellRendererText *cell, gtk_list_store_set (GTK_LIST_STORE (model), &iter, CLUE_KEYWORD_COLUMN, keyword, CLUE_VALUE_COLUMN, new_text, -1); + g_free (keyword); commit_changes (ui); } |