[tracker/journal] libtracker-data: No strdup for strings that aren't freed
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/journal] libtracker-data: No strdup for strings that aren't freed
- Date: Thu, 11 Mar 2010 13:26:25 +0000 (UTC)
commit 32e45380db19e67f168947872ffc2953537cf152
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Mar 11 14:24:50 2010 +0100
libtracker-data: No strdup for strings that aren't freed
src/libtracker-data/tracker-data-update.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 282288a..6632765 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -80,7 +80,7 @@ struct _TrackerDataUpdateBufferResource {
};
struct _TrackerDataUpdateBufferProperty {
- gchar *name;
+ const gchar *name;
GValue value;
gint graph;
gboolean fts : 1;
@@ -281,7 +281,6 @@ cache_table_free (TrackerDataUpdateBufferTable *table)
for (i = 0; i < table->properties->len; i++) {
property = &g_array_index (table->properties, TrackerDataUpdateBufferProperty, i);
- g_free (property->name);
g_value_unset (&property->value);
}
@@ -327,7 +326,10 @@ cache_insert_value (const gchar *table_name,
TrackerDataUpdateBufferTable *table;
TrackerDataUpdateBufferProperty property;
- property.name = g_strdup (field_name);
+ /* No need to strdup here, the incoming string is either always static, or
+ * long-standing as tracker_property_get_name return value. */
+ property.name = field_name;
+
property.value = *value;
property.graph = graph;
property.fts = fts;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]