summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-03-21 19:48:32 +0100
committerJens Axboe <axboe@kernel.dk>2012-03-21 19:48:32 +0100
commit4c0cd537f392e8a824d0080675f07b84c355af20 (patch)
tree1fb7dcc3c5e77aac73f082caa8c8c138f3bbe305 /graph.c
parent08d7d5a80f3698f9a5b362831762c23e99fd9a22 (diff)
downloadfio-4c0cd537f392e8a824d0080675f07b84c355af20.tar.gz
fio-4c0cd537f392e8a824d0080675f07b84c355af20.tar.bz2
graph: fix crash on alias in prio tree
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/graph.c b/graph.c
index 84bc9f9b..0dae510a 100644
--- a/graph.c
+++ b/graph.c
@@ -707,6 +707,7 @@ static void graph_label_add_value(struct graph_label *i, void *value,
double yval = gety(x);
double miny = yval / TOOLTIP_DELTA;
double maxy = yval * TOOLTIP_DELTA;
+ struct prio_tree_node *ret;
INIT_PRIO_TREE_NODE(&x->node);
x->node.start = miny;
@@ -714,8 +715,16 @@ static void graph_label_add_value(struct graph_label *i, void *value,
if (x->node.last == x->node.start)
x->node.last++;
- prio_tree_insert(&i->prio_tree, &x->node);
- i->tooltip_count++;
+ /*
+ * If ret != &x->node, we have an alias. Since the values
+ * should be identical, we can drop it
+ */
+ ret = prio_tree_insert(&i->prio_tree, &x->node);
+ if (ret != &x->node) {
+ free(x->tooltip);
+ x->tooltip = NULL;
+ } else
+ i->tooltip_count++;
}
if (i->parent->per_label_limit != -1 &&