[tracker] libtracker-common: Drop unneeded allocations in tracker_ontology_get_*
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Drop unneeded allocations in tracker_ontology_get_*
- Date: Tue, 8 Sep 2009 09:05:20 +0000 (UTC)
commit 5f85d9cc3b38896d733052bb21162bca569a1874
Author: Jürg Billeter <j bitron ch>
Date: Tue Sep 8 11:02:36 2009 +0200
libtracker-common: Drop unneeded allocations in tracker_ontology_get_*
Fixes memory leak in SPARQL engine.
src/libtracker-common/tracker-ontology.c | 9 +++------
src/libtracker-data/tracker-data-manager.c | 5 -----
src/libtracker-data/tracker-data-update.c | 4 ----
src/libtracker-db/tracker-db-backup.c | 1 -
src/tracker-fts/tracker-fts.c | 1 -
src/tracker-store/tracker-statistics.c | 4 ----
6 files changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-common/tracker-ontology.c b/src/libtracker-common/tracker-ontology.c
index dc4fe8a..0b8d647 100644
--- a/src/libtracker-common/tracker-ontology.c
+++ b/src/libtracker-common/tracker-ontology.c
@@ -164,22 +164,19 @@ tracker_ontology_get_class_by_uri (const gchar *class_uri)
TrackerNamespace **
tracker_ontology_get_namespaces (void)
{
- /* copy len + 1 elements to include NULL terminator */
- return g_memdup (namespaces->data, sizeof (TrackerNamespace *) * (namespaces->len + 1));
+ return (TrackerNamespace **) namespaces->data;
}
TrackerClass **
tracker_ontology_get_classes (void)
{
- /* copy len + 1 elements to include NULL terminator */
- return g_memdup (classes->data, sizeof (TrackerClass *) * (classes->len + 1));
+ return (TrackerClass **) classes->data;
}
TrackerProperty **
tracker_ontology_get_properties (void)
{
- /* copy len + 1 elements to include NULL terminator */
- return g_memdup (properties->data, sizeof (TrackerProperty *) * (properties->len + 1));
+ return (TrackerProperty **) properties->data;
}
/* Field mechanics */
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 0cf0a48..b94c5b9 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -631,7 +631,6 @@ create_decomposed_metadata_tables (TrackerDBInterface *iface,
g_string_append (sql, ")");
tracker_db_interface_execute_query (iface, NULL, "%s", sql->str);
- g_free (properties);
g_string_free (sql, TRUE);
/* create index for single-valued fields */
@@ -696,8 +695,6 @@ create_decomposed_transient_metadata_tables (TrackerDBInterface *iface)
}
}
-
- g_free (properties);
}
static void
@@ -818,8 +815,6 @@ tracker_data_manager_init (TrackerDBManagerFlags flags,
tracker_data_commit_transaction ();
- g_free (classes);
-
g_list_foreach (sorted, (GFunc) g_free, NULL);
g_list_free (sorted);
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index f6ec8e5..e270b1d 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -759,8 +759,6 @@ cache_set_metadata_decomposed (TrackerProperty *property,
}
}
- g_free (properties);
-
update_buffer.fts_ever_updated = TRUE;
old_values = g_hash_table_lookup (update_buffer.predicates, property);
@@ -1793,8 +1791,6 @@ tracker_data_delete_resource_description (const gchar *uri)
g_object_unref (cursor);
}
-
- g_free (properties);
}
diff --git a/src/libtracker-db/tracker-db-backup.c b/src/libtracker-db/tracker-db-backup.c
index d80f6cb..a3890af 100644
--- a/src/libtracker-db/tracker-db-backup.c
+++ b/src/libtracker-db/tracker-db-backup.c
@@ -332,7 +332,6 @@ tracker_db_backup_sync_fts (void)
g_free (query);
}
}
- g_free (properties);
tracker_fts_update_commit ();
}
diff --git a/src/tracker-fts/tracker-fts.c b/src/tracker-fts/tracker-fts.c
index 38acef5..c1278af 100644
--- a/src/tracker-fts/tracker-fts.c
+++ b/src/tracker-fts/tracker-fts.c
@@ -7871,7 +7871,6 @@ tracker_fts_get_create_fts_table_query (void)
g_string_append_printf (sql, "\"%s\"", tracker_property_get_name (*property));
}
}
- g_free (properties);
g_string_append (sql, ")");
diff --git a/src/tracker-store/tracker-statistics.c b/src/tracker-store/tracker-statistics.c
index 6cc10f0..260f6d7 100644
--- a/src/tracker-store/tracker-statistics.c
+++ b/src/tracker-store/tracker-statistics.c
@@ -174,8 +174,6 @@ cache_get_latest (void)
g_object_unref (stmt);
}
- g_free (classes);
-
return values;
}
@@ -241,8 +239,6 @@ tracker_statistics_get (TrackerStatistics *object,
g_ptr_array_add (values, strv);
}
- g_free (classes);
-
/* Sort result so it is alphabetical */
g_ptr_array_sort (values, cache_sort_func);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]