allow NULL pointers to cleanup/free calls.

This commit is contained in:
Joris Vink 2019-11-19 09:44:13 +01:00
parent 56c33f85d4
commit 283cd6da54
1 changed files with 6 additions and 0 deletions

View File

@ -125,6 +125,9 @@ kore_json_find(struct kore_json_item *root, const char *path, int type)
void
kore_json_cleanup(struct kore_json *json)
{
if (json == NULL)
return;
kore_buf_cleanup(&json->tmpbuf);
kore_json_item_free(json->root);
}
@ -322,6 +325,9 @@ kore_json_item_free(struct kore_json_item *item)
{
struct kore_json_item *node;
if (item == NULL)
return;
switch (item->type) {
case KORE_JSON_TYPE_OBJECT:
case KORE_JSON_TYPE_ARRAY: