aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-05 15:26:06 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-05 16:53:02 -0500
commite47280879899214015a85bdc96c4b7febeeedb3e (patch)
treea5cda4a75b2c8ee0597ce561629d5af34cd0cfbe
parentfd1b2cdfca907b638684c8c006846bcc07b458a8 (diff)
trace-view: Compare list all but last item in list
The last item is not added to the compare, because the compare tests each item plus the next. If we compared the last item, it may compare a invalid pointer. But the code compares all but the last 2 items! Which means we may return NULL when we should have found something. Compare that second to last item. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-view-store.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/trace-view-store.c b/trace-view-store.c
index 9e36493..7361722 100644
--- a/trace-view-store.c
+++ b/trace-view-store.c
@@ -1186,7 +1186,7 @@ search_for_record_by_timestamp(TraceViewStore *store, guint64 ts)
1186 return store->rows[store->visible_rows-1]; 1186 return store->rows[store->visible_rows-1];
1187 1187
1188 key.timestamp = ts; 1188 key.timestamp = ts;
1189 prec = bsearch(&key, store->rows, store->visible_rows - 2, 1189 prec = bsearch(&key, store->rows, store->visible_rows - 1,
1190 sizeof(store->rows[0]), rows_ts_cmp); 1190 sizeof(store->rows[0]), rows_ts_cmp);
1191 1191
1192 g_assert(prec != NULL); 1192 g_assert(prec != NULL);