[tracker/rss-enclosures] libtracker-bus: multi-insert: Handle memory for errors



commit 5f83f138523ab77abe2f8131f40d4dcae0fe2e53
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Oct 7 12:29:43 2010 +0200

    libtracker-bus: multi-insert: Handle memory for errors

 autogen.sh                                 |    2 +-
 src/libtracker-bus/tracker-bus-fd-update.c |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index 4e919ac..c04cf49 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,7 +8,7 @@ test -z "$srcdir" && srcdir=.
 
 PKG_NAME="tracker"
 REQUIRED_AUTOMAKE_VERSION=1.11
-REQUIRED_VALA_VERSION=0.9.5
+REQUIRED_VALA_VERSION=0.11.0
 
 (test -f $srcdir/configure.ac \
   && test -f $srcdir/README) || {
diff --git a/src/libtracker-bus/tracker-bus-fd-update.c b/src/libtracker-bus/tracker-bus-fd-update.c
index b1d0c26..2170c3c 100644
--- a/src/libtracker-bus/tracker-bus-fd-update.c
+++ b/src/libtracker-bus/tracker-bus-fd-update.c
@@ -204,6 +204,14 @@ sparql_update_fast_callback (DBusPendingCall *call,
 }
 
 static void
+sparql_update_array_error_free (gpointer data)
+{
+	if (data) {
+		g_error_free (data);
+	}
+}
+
+static void
 sparql_update_array_fast_callback (DBusPendingCall *call,
                                    void            *user_data)
 {
@@ -239,7 +247,7 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
 		dbus_message_iter_init (reply, &iter);
 		dbus_message_iter_recurse (&iter, &subiter);
 
-		errors = g_ptr_array_new_with_free_func ((GDestroyNotify) g_error_free);
+		errors = g_ptr_array_new_with_free_func (sparql_update_array_error_free);
 
 		while (dbus_message_iter_get_arg_type (&subiter) != DBUS_TYPE_INVALID) {
 			gchar *code, *message;
@@ -248,7 +256,10 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
 			dbus_message_iter_get_basic (&subiter, &code);
 			dbus_message_iter_next (&subiter);
 			dbus_message_iter_get_basic (&subiter, &message);
-			error = g_error_new_literal (TRACKER_SPARQL_ERROR, 0, message);
+			if (code && code[0] != '\0' && message && message[0] != '\0')
+				error = g_error_new_literal (TRACKER_SPARQL_ERROR, 0, message);
+			else
+				error = NULL;
 			g_free (code);
 			g_free (message);
 			g_ptr_array_add (errors, error);



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