From 12c4bf1986c288950a3d06da757109a6aa1ece38 Mon Sep 17 00:00:00 2001 From: Nicolas Badoux Date: Fri, 30 Aug 2024 15:09:28 +0200 Subject: [PATCH] Wrong counter increment --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 9399c0dd..d7c72363 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2794,7 +2794,7 @@ cJSON * cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse) if(depth >= CJSON_CIRCULAR_LIMIT) { goto fail; } - newchild = cJSON_Duplicate_rec(child, ++depth, true); /* Duplicate (with recurse) each item in the ->next chain */ + newchild = cJSON_Duplicate_rec(child, depth + 1, true); /* Duplicate (with recurse) each item in the ->next chain */ if (!newchild) { goto fail;