From d725a138c5c311ba06567d6841933aa5b7b6a435 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Thu, 11 Sep 2014 23:41:44 +0200 Subject: [PATCH] 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 --- src/analyze/analyze.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/analyze/analyze.c src/analyze/analyze.c index d860a02..1281d6b 100644 --- src/analyze/analyze.c +++ 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; } -- 1.7.9.2