From: Andreas Henriksson Date: Tue, 16 Sep 2014 17:40:25 +0000 (+0200) Subject: bootchart: oom-check correct variable X-Git-Tag: v217~556 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;ds=sidebyside;h=d498a616075ebfd8025d66c4c4f725d24eb3aca3;hp=e10f3c431a3bc1a94fbe9d2a14d3025550f9672e;p=elogind.git bootchart: oom-check correct variable Coverity warned that we have already dereferenced ps->sample before null-checking it. I suspect that's not really the issue and that the check is checking the wrong variable. Likely the oom-check should be on the just allocated ps->sample->next. Found by coverity. Fixes: CID#1237765 --- diff --git a/src/bootchart/store.c b/src/bootchart/store.c index ed46a503c..ed683e88d 100644 --- a/src/bootchart/store.c +++ b/src/bootchart/store.c @@ -399,7 +399,7 @@ schedstat_next: continue; ps->sample->next = new0(struct ps_sched_struct, 1); - if (!ps->sample) { + if (!ps->sample->next) { log_oom(); exit(EXIT_FAILURE); }