Fixed stackover flow bug in qcloud_json_token.c

Add if ‘NULL’:
            if (NULL == entry) {
                return NULL;
            }
This commit is contained in:
David Lin 2020-03-15 21:47:54 +08:00 committed by GitHub
parent 9d6dd6398e
commit cc88371d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -109,6 +109,9 @@ list_head_t *LITE_json_keys_of(char *src, char *prefix)
json_key_t *entry = NULL;
entry = osal_malloc(sizeof(json_key_t));
if (NULL == entry) {
return NULL;
}
memset(entry, 0, sizeof(json_key_t));
entry->key = LITE_format_string("%s%.*s", prefix, klen, key);
list_add_tail(&entry->list, &keylist);
@ -127,6 +130,9 @@ list_head_t *LITE_json_keys_of(char *src, char *prefix)
json_key_t *entry = NULL;
entry = osal_malloc(sizeof(json_key_t));
if (NULL == entry) {
return NULL;
}
memset(entry, 0, sizeof(json_key_t));
list_add_tail(&entry->list, &keylist);