summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Zhbanov <i.zhbanov@samsung.com>2013-10-15 14:35:13 +0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-15 09:40:34 -0400
commit306e6650221d88b29831bcdcef94447afb65df5c (patch)
tree8246089ac0060fe046c1914e938754a1d9612172
parent72f4d9669c253d5bd7c126bf2e7a0db0198cf2eb (diff)
Fix for SIGSEGV in systemd-bootchart on short-living processes
The function svg_ps_bars() dereferencess NULL pointer in the line endtime = ps->last->sampledata->sampletime; because of partially initialized ps_struct (ps->last == NULL). If some process terminates between scaning /proc directory in the log_sample() function and reading additional information from /proc/PID/... files, the files couldn't be read, the loop will be continued and partially initialized structure returned.
-rw-r--r--src/bootchart/store.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index f8c97c2324..7f86cfe976 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -275,7 +275,7 @@ schedstat_next:
pscount++;
/* mark our first sample */
- ps->first = ps->sample;
+ ps->first = ps->last = ps->sample;
ps->sample->runtime = atoll(rt);
ps->sample->waittime = atoll(wt);