diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/jplist.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/jplist.c b/src/jplist.c index c149d20..88cce28 100644 --- a/src/jplist.c +++ b/src/jplist.c | |||
| @@ -596,6 +596,9 @@ static plist_t parse_array(const char* js, jsmntok_t* tokens, int* index) | |||
| 596 | } | 596 | } |
| 597 | if (val) { | 597 | if (val) { |
| 598 | plist_array_append_item(arr, val); | 598 | plist_array_append_item(arr, val); |
| 599 | } else { | ||
| 600 | plist_free(arr); | ||
| 601 | return NULL; | ||
| 599 | } | 602 | } |
| 600 | } | 603 | } |
| 601 | *(index) = j; | 604 | *(index) = j; |
| @@ -616,6 +619,7 @@ static plist_t parse_object(const char* js, jsmntok_t* tokens, int* index) | |||
| 616 | if (tokens[j].type == JSMN_STRING) { | 619 | if (tokens[j].type == JSMN_STRING) { |
| 617 | char* key = unescape_string(js + tokens[j].start, tokens[j].end - tokens[j].start, NULL); | 620 | char* key = unescape_string(js + tokens[j].start, tokens[j].end - tokens[j].start, NULL); |
| 618 | if (!key) { | 621 | if (!key) { |
| 622 | plist_free(obj); | ||
| 619 | return NULL; | 623 | return NULL; |
| 620 | } | 624 | } |
| 621 | plist_t val = NULL; | 625 | plist_t val = NULL; |
| @@ -643,6 +647,7 @@ static plist_t parse_object(const char* js, jsmntok_t* tokens, int* index) | |||
| 643 | free(key); | 647 | free(key); |
| 644 | } else { | 648 | } else { |
| 645 | PLIST_JSON_ERR("%s: keys must be of type STRING\n", __func__); | 649 | PLIST_JSON_ERR("%s: keys must be of type STRING\n", __func__); |
| 650 | plist_free(obj); | ||
| 646 | return NULL; | 651 | return NULL; |
| 647 | } | 652 | } |
| 648 | } | 653 | } |
