From 0be64fc2b0b9841e57ab337d7de1ddaf99aa4c5a Mon Sep 17 00:00:00 2001
From: Burkhard Ilsen <burkhardilsen@gmail.com>
Date: Tue, 4 Apr 2017 19:20:17 +0200
Subject: [PATCH] servo: NULL pointer check for servo constructors

The servo constructors might return a NULL pointer.
The function servo_create() uses servo without checks.

Signed-off-by: Burkhard Ilsen <burkhardilsen@gmail.com>
---
 servo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/servo.c b/servo.c
index 9aab7f2..4af0061 100644
--- a/servo.c
+++ b/servo.c
@@ -51,6 +51,9 @@ struct servo *servo_create(struct config *cfg, enum servo_type type,
 	default:
 		return NULL;
 	}
+	
+	if (!servo)
+		return NULL;
 
 	servo_step_threshold = config_get_double(cfg, NULL, "step_threshold");
 	if (servo_step_threshold > 0.0) {
-- 
2.12.2.windows.1

