From 3e1cedfc7490af09cd585914e92688c38cac4a6b Mon Sep 17 00:00:00 2001 From: ckolivas Date: Thu, 29 Jan 2015 15:00:46 +1100 Subject: [PATCH] Sanity check various jp parameters before trying to decref them --- src/stratifier.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index b6370468..7538a8ef 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3488,9 +3488,12 @@ static void ssend_process(ckpool_t *ckp, smsg_t *msg) static void discard_json_params(json_params_t *jp) { - json_decref(jp->method); - json_decref(jp->params); - json_decref(jp->id_val); + if (likely(jp->method)) + json_decref(jp->method); + if (likely(jp->params)) + json_decref(jp->params); + if (likely(jp->id_val)) + json_decref(jp->id_val); free(jp); }