[tracker] Fixed potential leak found in 0.6 branch last week
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] Fixed potential leak found in 0.6 branch last week
- Date: Mon, 4 May 2009 08:49:39 -0400 (EDT)
commit 62247c24cf0a1ed3846bdf298e1f875204d3c19c
Author: Martyn Russell <martyn imendio com>
Date: Mon May 4 13:48:53 2009 +0100
Fixed potential leak found in 0.6 branch last week
---
src/libtracker-db/tracker-db-dbus.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/libtracker-db/tracker-db-dbus.c b/src/libtracker-db/tracker-db-dbus.c
index ac1ec61..77d1756 100644
--- a/src/libtracker-db/tracker-db-dbus.c
+++ b/src/libtracker-db/tracker-db-dbus.c
@@ -49,7 +49,7 @@ row_add (GPtrArray *row,
g_ptr_array_add (row, elem);
}
-static inline void
+static inline gboolean
row_insert (GPtrArray *row,
gchar *value,
guint lindex)
@@ -67,12 +67,14 @@ row_insert (GPtrArray *row,
*/
for (iter = list; iter; iter=iter->next) {
if (strcmp (iter->data, value) == 0) {
- return;
+ return FALSE;
}
}
list = g_slist_prepend (list, value);
elem->value = list;
+
+ return TRUE;
}
static inline void
@@ -124,6 +126,7 @@ rows_destroy (GPtrArray *rows)
for (i = 0; i < rows->len; i++) {
OneRow *row;
+
row = g_ptr_array_index (rows, i);
row_destroy (row->value);
g_slice_free (OneRow, row);
@@ -542,7 +545,10 @@ tracker_dbus_query_result_multi_to_ptr_array (TrackerDBResultSet *result_set)
if (add) {
row_add (row, str);
} else {
- row_insert (row, str, column-1);
+ if (!row_insert (row, str, column-1)) {
+ /* Failed to insert */
+ g_free (str);
+ }
}
g_value_unset (&value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]