[tracker/tracker-store-queue] tracker-resources.c: Fix leak and minimize differences to tracker-store



commit 25039e79dab8c0502f48b05595df9d84ec5858f6
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 26 13:48:18 2009 +0200

    tracker-resources.c: Fix leak and minimize differences to tracker-store
---
 src/tracker-store/tracker-resources.c |   38 +++++++++++++++-----------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 9776d12..be95c5d 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -128,8 +128,7 @@ tracker_resources_insert (TrackerResources	     *self,
 			  DBusGMethodInvocation      *context,
 			  GError		    **error)
 {
-	TrackerResourcesPrivate *priv;
-	guint		         request_id;
+	guint		    request_id;
 
 	request_id = tracker_dbus_get_next_request_id ();
 
@@ -142,8 +141,6 @@ tracker_resources_insert (TrackerResources	     *self,
 				  "'%s' '%s' '%s'",
 				  subject, predicate, object);
 
-	priv = TRACKER_RESOURCES_GET_PRIVATE (self);
-
 	tracker_store_insert_statement (subject, predicate, object);
 
 	dbus_g_method_return (context);
@@ -159,8 +156,7 @@ tracker_resources_delete (TrackerResources	     *self,
 			  DBusGMethodInvocation      *context,
 			  GError		    **error)
 {
-	TrackerResourcesPrivate *priv;
-	guint		         request_id;
+	guint		    request_id;
 
 	request_id = tracker_dbus_get_next_request_id ();
 
@@ -169,12 +165,10 @@ tracker_resources_delete (TrackerResources	     *self,
 	tracker_dbus_async_return_if_fail (object != NULL, context);
 
 	tracker_dbus_request_new (request_id,
-				  "DBus request to insert statement: "
+				  "DBus request to delete statement: "
 				  "'%s' '%s' '%s'",
 				  subject, predicate, object);
 
-	priv = TRACKER_RESOURCES_GET_PRIVATE (self);
-
 	tracker_store_delete_statement (subject, predicate, object);
 
 	dbus_g_method_return (context);
@@ -209,10 +203,10 @@ tracker_resources_load (TrackerResources	 *object,
 			DBusGMethodInvocation	 *context,
 			GError			**error)
 {
-	guint   request_id;
+	guint		    request_id;
 	GFile  *file;
 	gchar  *path;
-	GError *actual_error = NULL;
+	GError		   *actual_error = NULL;
 
 	request_id = tracker_dbus_get_next_request_id ();
 
@@ -226,8 +220,8 @@ tracker_resources_load (TrackerResources	 *object,
 	file = g_file_new_for_uri (uri);
 	path = g_file_get_path (file);
 
-	tracker_store_queue_turtle_import (path, NULL, 
-	                                   on_turtle_process_statement, 
+	tracker_store_queue_turtle_import (path, NULL,
+	                                   on_turtle_process_statement,
 	                                   NULL, on_turtle_destroy);
 
 	g_free (path);
@@ -251,10 +245,10 @@ tracker_resources_sparql_query (TrackerResources	 *self,
 				DBusGMethodInvocation	 *context,
 				GError			**error)
 {
-	guint           request_id;
-	GPtrArray      *values;
-	TrackerDBResultSet *result_set;
-	GError         *actual_error = NULL;
+	TrackerDBResultSet   *result_set;
+	GError 		     *actual_error = NULL;
+	guint		      request_id;
+	GPtrArray            *values;
 
 	request_id = tracker_dbus_get_next_request_id ();
 
@@ -282,6 +276,10 @@ tracker_resources_sparql_query (TrackerResources	 *self,
 
 	tracker_dbus_results_ptr_array_free (&values);
 
+	if (result_set) {
+		g_object_unref (result_set);
+	}
+
 	tracker_dbus_request_success (request_id);
 }
 
@@ -292,8 +290,8 @@ tracker_resources_sparql_update (TrackerResources	 *self,
 				 GError			**error)
 {
 	TrackerResourcesPrivate *priv;
-	guint                    request_id;
-	GError                  *actual_error = NULL;
+	GError 		     *actual_error = NULL;
+	guint		      request_id;
 
 	priv = TRACKER_RESOURCES_GET_PRIVATE (self);
 
@@ -348,7 +346,7 @@ tracker_resources_batch_sparql_update (TrackerResources          *self,
 {
 	TrackerDBusMethodInfo   *info;
 	TrackerResourcesPrivate *priv;
-	guint		         request_id;
+	guint		      request_id;
 
 	priv = TRACKER_RESOURCES_GET_PRIVATE (self);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]