From 022e2d0d9d83ae804cf9a1ccfbbe4f5b36fac67c Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Wed, 11 Dec 2013 00:53:35 +0100 Subject: Guard against dereferencing undef Introduce some harness in ProfileGraphicsView::plot_one_event, so we detect bad stuff and bail, instead of dereferencing undef pointers. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/profilegraphics.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index f99fd4d2e..18e97da78 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -956,7 +956,7 @@ void ProfileGraphicsView::plot_one_event(struct event *ev) { int i; struct plot_info *pi = &gc.pi; - struct plot_data *entry; + struct plot_data *entry = NULL; /* is plotting of this event disabled? */ if (ev->name) { @@ -981,6 +981,10 @@ void ProfileGraphicsView::plot_one_event(struct event *ev) break; } + /* If we didn't find the right event, don't dereference null */ + if (entry == NULL) + return; + /* draw a little triangular marker and attach tooltip */ int x = SCALEXGC(ev->time.seconds); -- cgit v1.2.3-70-g09d2