[tracker/dbus-fd-experiment: 10/19] Steroids server: Fix leak in query_inthread



commit cb1b73d1593ee1d84e5c0be4f0922557d3f642e2
Author: Adrien Bustany <abustany gnome org>
Date:   Mon Jun 14 10:45:05 2010 -0400

    Steroids server: Fix leak in query_inthread
    
    The GUnixOutputStream created in query_inthread would be leaked.

 src/tracker-store/tracker-steroids.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index e8ad419..9ebfd82 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -244,6 +244,7 @@ query_inthread (TrackerDBCursor *cursor,
 	InThreadPtr *ptr  = g_slice_new0 (InThreadPtr);
 	ClientInfo  *info = user_data;
 	GError *loop_error = NULL;
+	GOutputStream *unix_output_stream;
 	GOutputStream *output_stream;
 	GDataOutputStream *data_output_stream;
 	guint n_columns;
@@ -251,7 +252,8 @@ query_inthread (TrackerDBCursor *cursor,
 	int *column_offsets;
 	const gchar **column_data;
 
-	output_stream = g_buffered_output_stream_new_sized (g_unix_output_stream_new (info->fd, TRUE),
+	unix_output_stream = g_unix_output_stream_new (info->fd, TRUE);
+	output_stream = g_buffered_output_stream_new_sized (unix_output_stream,
 	                                                    TRACKER_STEROIDS_BUFFER_SIZE);
 	data_output_stream = g_data_output_stream_new (output_stream);
 
@@ -262,6 +264,7 @@ query_inthread (TrackerDBCursor *cursor,
 		                                NULL);
 		g_object_unref (data_output_stream);
 		g_object_unref (output_stream);
+		g_object_unref (unix_output_stream);
 		ptr->error = g_error_copy (error);
 		return ptr;
 	}
@@ -347,6 +350,7 @@ end_query_inthread:
 	/* Will force flushing */
 	g_object_unref (data_output_stream);
 	g_object_unref (output_stream);
+	g_object_unref (unix_output_stream);
 
 	if (loop_error) {
 		ptr->error = loop_error;



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