From 56f81811c2090c3d1a48523e018ed2eca7a58217 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 2 Apr 2020 19:23:10 +0200 Subject: [PATCH 1/2] Changed order of calloc args to match stdlib Although it is currently working, it's worth to stick with the stdlib definition to avoid further problems --- json_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_object.c b/json_object.c index 9646164..cb518af 100644 --- a/json_object.c +++ b/json_object.c @@ -228,7 +228,7 @@ static struct json_object* json_object_new(enum json_type o_type) { struct json_object *jso; - jso = (struct json_object*)calloc(sizeof(struct json_object), 1); + jso = (struct json_object*)calloc(1, sizeof(struct json_object)); if (!jso) return NULL; jso->o_type = o_type; From 5d9b8e0fef9dd7ebdc393e109cd3c646efb5593d Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 2 Apr 2020 19:28:55 +0200 Subject: [PATCH 2/2] Changed order of calloc args to match stdlib (2) Although it is currently working, it's worth to stick with the stdlib definition to avoid further problems --- arraylist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arraylist.c b/arraylist.c index 8a88ed1..3441ce1 100644 --- a/arraylist.c +++ b/arraylist.c @@ -46,7 +46,7 @@ array_list_new(array_list_free_fn *free_fn) arr->size = ARRAY_LIST_DEFAULT_SIZE; arr->length = 0; arr->free_fn = free_fn; - if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) { + if(!(arr->array = (void**)calloc(arr->size, sizeof(void*)))) { free(arr); return NULL; }