|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From d725a138c5c311ba06567d6841933aa5b7b6a435 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Thu, 11 Sep 2014 23:41:44 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] analyze: avoid a null dereference
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
If we have an error in the early sd_bus_* calls then unit_times
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
will still be null.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Found with coverity. Fixes: CID#996464
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/analyze/analyze.c | 3 ++-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index d860a022b7..1281d6b9ea 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/analyze/analyze.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/analyze/analyze.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -277,7 +277,8 @@ static int acquire_time_data(sd_bus *bus, struct unit_times **out) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return c;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- free_unit_times(unit_times, (unsigned) c);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (unit_times)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ free_unit_times(unit_times, (unsigned) c);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|