chiark / gitweb /
bootchart: svg: fix checking of list end
authorAaro Koskinen <aaro.koskinen@nokia.com>
Tue, 24 Feb 2015 16:32:31 +0000 (18:32 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 25 Feb 2015 04:51:55 +0000 (23:51 -0500)
If we have less samples than expected, systemd-bootchart will crash.

src/bootchart/svg.c

index 93b4764..e1fc531 100644 (file)
@@ -1167,7 +1167,7 @@ static void svg_ps_bars(void) {
 
                 ps->sample = ps->sample->next;
                 sample_hz = ps->sample;
-                for (ii=0;((ii<(int)arg_hz/2)&&(ps->sample->next));ii++)
+                for (ii=0;((ii<(int)arg_hz/2)&&(sample_hz->next));ii++)
                         sample_hz = sample_hz->next;
 
                 /* subtract bootchart cpu utilization from total */