[anjuta] symbol-db: Fix leaks of two GPtrArrays in do_import_system_sources_after_abort()



commit f02c3c41719fa3ba042b1c1b3effaa08de82b2c7
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Wed Jan 9 15:27:57 2013 +0100

    symbol-db: Fix leaks of two GPtrArrays in do_import_system_sources_after_abort()

 plugins/symbol-db/plugin.c           |   12 ++++++------
 plugins/symbol-db/symbol-db-system.c |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index a36ca43..6b9b389 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1125,8 +1125,8 @@ do_import_system_sources_after_abort (SymbolDBPlugin *sdb_plugin,
 										NULL);
 	
 	/* create array of languages */
-	languages_array = g_ptr_array_new ();
-	to_scan_array = g_ptr_array_new ();
+	languages_array = g_ptr_array_new_with_free_func (g_free);
+	to_scan_array = g_ptr_array_new_with_free_func (g_free);
 	
 	if (!lang_manager)
 	{
@@ -1197,10 +1197,10 @@ do_import_system_sources_after_abort (SymbolDBPlugin *sdb_plugin,
 	symbol_db_system_parse_aborted_package (sdb_plugin->sdbs, 
 									 to_scan_array,
 									 languages_array);
-#endif	
-	/* no need to free the GPtrArray, Huston. They'll be auto-destroyed in that
-	 * function 
-	 */
+#endif
+
+	g_ptr_array_unref(to_scan_array);
+	g_ptr_array_unref(languages_array);
 }
 
 /* we assume that sources_array has already unique elements */
diff --git a/plugins/symbol-db/symbol-db-system.c b/plugins/symbol-db/symbol-db-system.c
index d76dd27..291b885 100644
--- a/plugins/symbol-db/symbol-db-system.c
+++ b/plugins/symbol-db/symbol-db-system.c
@@ -807,8 +807,8 @@ symbol_db_system_parse_aborted_package (SymbolDBSystem *sdbs,
 	es_data->cflags = NULL;
 	es_data->package_name = g_strdup (_("Resuming glb scan."));
 	es_data->special_abort_scan = TRUE;
-	es_data->files_to_scan_array = files_to_scan_array;
-	es_data->languages_array = languages_array;
+	es_data->files_to_scan_array = g_ptr_array_ref (files_to_scan_array);
+	es_data->languages_array = g_ptr_array_ref (languages_array);
 		
 		
 	DEBUG_PRINT ("SYSTEM ABORT PARSING.....");



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