[anjuta] symbol-db: Fix leak of file_abs_path in symbol_db_engine_update_project_symbols().
- From: Carl-Anton Ingmarsson <carlantoni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: Fix leak of file_abs_path in symbol_db_engine_update_project_symbols().
- Date: Wed, 9 Jan 2013 20:38:21 +0000 (UTC)
commit 17eabf959d1965d5bfb482a83e8d68149aa87662
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Wed Jan 9 18:03:13 2013 +0100
symbol-db: Fix leak of file_abs_path in symbol_db_engine_update_project_symbols().
Remove unnecessary check if (priv->project_directory != NULL) since that is guarded
against with a g_return_val_if_fail() at the beginning of the function.
Remove unnecessary check if the result of g_file_new_for_path() is NULL since
g_file_new_for_path() never fails according to the documentation.
plugins/symbol-db/symbol-db-engine-core.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index b0fff5f..1c76ef2 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -5489,16 +5489,13 @@ symbol_db_engine_update_project_symbols (SymbolDBEngine *dbe,
/* build abs path. */
file_name = g_value_get_string (value);
- if (priv->project_directory != NULL)
- {
- file_abs_path = g_build_filename (priv->project_directory,
- file_name, NULL);
- }
-
- gfile = g_file_new_for_path (file_abs_path);
- if (gfile == NULL)
+ if (!file_name)
continue;
+ file_abs_path = g_build_filename (priv->project_directory,
+ file_name, NULL);
+
+ gfile = g_file_new_for_path (file_abs_path);
gfile_is = g_file_read (gfile, NULL, NULL);
/* retrieve data/time info */
if (gfile_is == NULL)
@@ -5551,10 +5548,13 @@ symbol_db_engine_update_project_symbols (SymbolDBEngine *dbe,
{
g_ptr_array_add (files_to_scan, file_abs_path);
}
+ else
+ {
+ g_free (file_abs_path);
+ }
g_object_unref (gfile_info);
g_object_unref (gfile);
- /* no need to free file_abs_path, it's been added to files_to_scan */
}
if (data_model)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]