From: Thomas Hindoe Paaboel Andersen Date: Thu, 11 Sep 2014 21:41:44 +0000 (+0200) Subject: analyze: avoid a null dereference X-Git-Tag: v217~589 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=d725a138c5c311ba06567d6841933aa5b7b6a435 analyze: avoid a null dereference If we have an error in the early sd_bus_* calls then unit_times will still be null. Found with coverity. Fixes: CID#996464 --- diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index d860a022b..1281d6b9e 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -277,7 +277,8 @@ static int acquire_time_data(sd_bus *bus, struct unit_times **out) { return c; fail: - free_unit_times(unit_times, (unsigned) c); + if (unit_times) + free_unit_times(unit_times, (unsigned) c); return r; }