From c5f418f1db2766c3c075d0b79f9b7be14153228d Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 16 Sep 2017 12:34:00 +1000 Subject: [PATCH] Handle null entries too. --- src/stratifier.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index a7309eec..def9558f 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3322,7 +3322,8 @@ static void _dec_instance_ref(sdata_t *sdata, stratum_instance_t *client, const } ck_wunlock(&sdata->instance_lock); - notice_msg_entries(&entries); + if (entries) + notice_msg_entries(&entries); /* This should never happen */ if (unlikely(ref < 0)) LOGERR("Instance ref count dropped below zero from %s %s:%d", file, func, line); @@ -3541,7 +3542,7 @@ static void drop_client(ckpool_t *ckp, sdata_t *sdata, const int64_t id) { char_entry_t *entries = NULL; stratum_instance_t *client; - char *msg; + char *msg = NULL; LOGINFO("Stratifier asked to drop client %"PRId64, id); @@ -3553,13 +3554,15 @@ static void drop_client(ckpool_t *ckp, sdata_t *sdata, const int64_t id) * now but wait till the reference is dropped */ if (!client->ref) { __drop_client(sdata, client, false, &msg); - add_msg_entry(&entries, &msg); + if (msg) + add_msg_entry(&entries, &msg); } else client->dropped = true; } ck_wunlock(&sdata->instance_lock); - notice_msg_entries(&entries); + if (entries) + notice_msg_entries(&entries); reap_proxies(ckp, sdata); }