dcavalca / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone
a52f674
From 6a5ca4af4911b8dee459ab409e73929ab57f6c82 Mon Sep 17 00:00:00 2001
794d16c
From: Igor Zhbanov <i.zhbanov@samsung.com>
794d16c
Date: Tue, 15 Oct 2013 14:35:13 +0400
794d16c
Subject: [PATCH] Fix for SIGSEGV in systemd-bootchart on short-living
794d16c
 processes
794d16c
794d16c
The function svg_ps_bars() dereferencess NULL pointer in the line
794d16c
	endtime = ps->last->sampledata->sampletime;
794d16c
because of partially initialized ps_struct (ps->last == NULL).
794d16c
794d16c
If some process terminates between scaning /proc directory in the log_sample()
794d16c
function and reading additional information from /proc/PID/... files,
794d16c
the files couldn't be read, the loop will be continued and partially
794d16c
initialized structure returned.
794d16c
---
794d16c
 src/bootchart/store.c | 2 +-
794d16c
 1 file changed, 1 insertion(+), 1 deletion(-)
794d16c
794d16c
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
1cc3df3
index f8c97c2324..7f86cfe976 100644
794d16c
--- a/src/bootchart/store.c
794d16c
+++ b/src/bootchart/store.c
794d16c
@@ -275,7 +275,7 @@ schedstat_next:
794d16c
                         pscount++;
794d16c
 
794d16c
                         /* mark our first sample */
794d16c
-                        ps->first = ps->sample;
794d16c
+                        ps->first = ps->last = ps->sample;
794d16c
                         ps->sample->runtime = atoll(rt);
794d16c
                         ps->sample->waittime = atoll(wt);
794d16c