[tracker/harmattan-pre-signal-updates: 1366/1380] tracker-store: Fix crash when accessing variable_names array



commit ad59f95381999c91ede005d902d324bf41f03f24
Author: Jürg Billeter <j bitron ch>
Date:   Fri Sep 17 17:23:37 2010 +0200

    tracker-store: Fix crash when accessing variable_names array

 src/tracker-store/tracker-steroids.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 538514d..875b7a9 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -292,7 +292,8 @@ query_inthread (TrackerDBCursor *cursor,
 	column_data = alloca (n_columns * sizeof (gchar*));
 	column_types = alloca (n_columns * sizeof (gchar*));
 
-	variable_names = g_new0 (gchar *, n_columns);
+	/* n_columns + 1 for NULL termination */
+	variable_names = g_new0 (gchar *, n_columns + 1);
 	for (i = 0; i < n_columns; i++) {
 		variable_names[i] = g_strdup (tracker_db_cursor_get_variable_name (cursor, i));
 	}



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