From 07d57d683d831f4b57ac8676753cccfd5dbec0a0 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 4 Jan 2017 19:22:29 +1100 Subject: [PATCH] Prevent passthrough and node etc. failure in generator at startup due to proxy recruit change. --- src/generator.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/generator.c b/src/generator.c index 19483c60..b6b153a0 100644 --- a/src/generator.c +++ b/src/generator.c @@ -2020,11 +2020,13 @@ out: if (ret) { proxy_instance_t *parent = proxi->parent; - mutex_lock(&parent->proxy_lock); - parent->recruit -= proxi->clients_per_proxy; - if (parent->recruit < 0) - parent->recruit = 0; - mutex_unlock(&parent->proxy_lock); + if (parent) { + mutex_lock(&parent->proxy_lock); + parent->recruit -= proxi->clients_per_proxy; + if (parent->recruit < 0) + parent->recruit = 0; + mutex_unlock(&parent->proxy_lock); + } } return ret;