[tracker] libtracker-common: Fix use-after-free memory error in tracker-dbus
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Fix use-after-free memory error in tracker-dbus
- Date: Mon, 17 Jan 2011 16:35:58 +0000 (UTC)
commit 5724eed7cadf2906bfee381393da8b669b0fc60d
Author: Jürg Billeter <j bitron ch>
Date: Mon Jan 17 14:42:40 2011 +0100
libtracker-common: Fix use-after-free memory error in tracker-dbus
If a single request was taking longer than 5 minutes, client data was
freed but still used later on.
src/libtracker-common/tracker-dbus.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c
index f949d18..47371bb 100644
--- a/src/libtracker-common/tracker-dbus.c
+++ b/src/libtracker-common/tracker-dbus.c
@@ -38,6 +38,7 @@ typedef struct {
gchar *binary;
gulong pid;
guint clean_up_id;
+ gint n_active_requests;
} ClientData;
struct _TrackerDBusRequest {
@@ -241,11 +242,14 @@ client_get_for_sender (const gchar *sender)
sender_dup = g_strdup (sender);
cd = client_data_new (sender_dup);
g_hash_table_insert (clients, sender_dup, cd);
- } else {
+ }
+
+ if (cd->clean_up_id) {
g_source_remove (cd->clean_up_id);
+ cd->clean_up_id = 0;
}
- cd->clean_up_id = g_timeout_add_seconds (CLIENT_CLEAN_UP_TIME, client_clean_up_cb, cd);
+ cd->n_active_requests++;
return cd;
}
@@ -336,6 +340,14 @@ tracker_dbus_request_end (TrackerDBusRequest *request,
error->message);
}
+ if (request->cd) {
+ request->cd->n_active_requests--;
+
+ if (request->cd->n_active_requests == 0) {
+ request->cd->clean_up_id = g_timeout_add_seconds (CLIENT_CLEAN_UP_TIME, client_clean_up_cb, request->cd);
+ }
+ }
+
g_slice_free (TrackerDBusRequest, request);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]