From f42f1875294e6cb9081183b77450e61a70206300 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 13 Nov 2015 16:12:25 +1100 Subject: [PATCH] Revert "Allow add_msg_entry to be called with a null buffer safely" This reverts commit 5cc1812271c9ec35442c62cecacb8225f68ba08b. --- src/stratifier.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 7902db36..cfe8ec04 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -454,11 +454,8 @@ struct json_entry { * to the log outside of lock */ static void add_msg_entry(char_entry_t **entries, char **buf) { - char_entry_t *entry; + char_entry_t *entry = ckalloc(sizeof(char_entry_t)); - if (!*buf) - return; - entry = ckalloc(sizeof(char_entry_t)); entry->buf = *buf; *buf = NULL; DL_APPEND(*entries, entry); @@ -1340,7 +1337,10 @@ static void _dec_instance_ref(sdata_t *sdata, stratum_instance_t *client, const * moved due to holding a reference and drop them now. */ if (unlikely(client->dropped && !ref)) { __drop_client(sdata, client, true, &msg); - add_msg_entry(&entries, &msg); + /* Make sure there is a message as throttled users don't + * generate a message */ + if (msg) + add_msg_entry(&entries, &msg); } ck_wunlock(&sdata->instance_lock);