commit 283cd6da54fcd20f21d8222437903a4081b06bf9
parent 56c33f85d45791f48347566b4e7865cafadb65d5
Author: Joris Vink <joris@coders.se>
Date: Tue, 19 Nov 2019 09:44:13 +0100
allow NULL pointers to cleanup/free calls.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/json.c b/src/json.c
@@ -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: