[tracker/dbus-fd-experiment: 2/13] Fix memory corruption in Steroids server



commit 33a9d17ea75b47d785d42c590d619b9dfd73e105
Author: Adrien Bustany <abustany gnome org>
Date:   Fri May 21 12:21:31 2010 -0400

    Fix memory corruption in Steroids server

 src/tracker-store/tracker-steroids.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 1ac8499..a0d0d79 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -178,6 +178,9 @@ query_inthread (TrackerDBCursor *cursor,
 	ClientInfo  *info = user_data;
 	GError *loop_error = NULL;
 	guint n_columns;
+	int *column_sizes;
+	int *column_offsets;
+	const gchar **column_data;
 
 	if (error) {
 		ptr->error = g_error_copy (error);
@@ -186,9 +189,9 @@ query_inthread (TrackerDBCursor *cursor,
 
 	n_columns = tracker_db_cursor_get_n_columns (cursor);
 
-	int column_sizes[n_columns];
-	int column_offsets[n_columns];
-	const gchar* column_data[n_columns];
+	column_sizes = g_malloc (n_columns * sizeof (int));
+	column_offsets = g_malloc (n_columns * sizeof (int));
+	column_data = g_malloc (n_columns * sizeof (char*));
 
 	while (tracker_db_cursor_iter_next (cursor, &loop_error)) {
 		int i;
@@ -250,6 +253,10 @@ query_inthread (TrackerDBCursor *cursor,
 		ptr->error = loop_error;
 	}
 
+	g_free (column_sizes);
+	g_free (column_offsets);
+	g_free (column_data);
+
 	return ptr;
 }
 



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