[gedit-list] [PATCH] Fix a possible memory leak



Use g_strfreev() rather than g_free().

The GLib documentation for g_key_file_get_keys() states that g_strfreev()
should be used to free the return value.

See:  http://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html#g-key-file-get-keys
      http://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html#g-key-file-get-keys
---
 plugins/modelines/modeline-parser.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c
index a4d15a8..20fddb4 100644
--- a/plugins/modelines/modeline-parser.c
+++ b/plugins/modelines/modeline-parser.c
@@ -127,7 +127,7 @@ load_language_mappings_group (GKeyFile *key_file, const gchar *group)
 		gchar *id = g_key_file_get_string (key_file, group, name, NULL);
 		g_hash_table_insert (table, name, id);
 	}
-	g_free (keys);
+	g_strfreev (keys);
 
 	return table;
 }
-- 
1.7.6.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]