cJSON_strdup: Check for NULL string

This commit is contained in:
Max Bruckner 2017-01-05 21:31:17 +01:00
parent ddadb44a67
commit 1df987a170
1 changed files with 5 additions and 0 deletions

View File

@ -88,6 +88,11 @@ static char* cJSON_strdup(const char* str)
size_t len = 0;
char *copy = NULL;
if (str == NULL)
{
return NULL;
}
len = strlen(str) + 1;
if (!(copy = (char*)cJSON_malloc(len)))
{