diff --git a/client/sub_client_output.c b/client/sub_client_output.c index adb432ce..1cb984b6 100644 --- a/client/sub_client_output.c +++ b/client/sub_client_output.c @@ -353,6 +353,9 @@ static int json_print(const struct mosquitto_message *message, const mosquitto_p json_str = cJSON_PrintUnformatted(root); } cJSON_Delete(root); + if(json_str == NULL){ + return MOSQ_ERR_NOMEM; + } fputs(json_str, stdout); free(json_str);