src/json.c

changeset 1675
36c0fb2b60b2
parent 1672
94360453bce4
--- a/src/json.c	Sun Dec 28 15:45:39 2025 +0100
+++ b/src/json.c	Sun Dec 28 17:31:20 2025 +0100
@@ -1499,7 +1499,7 @@
 }
 
 CxJsonValue* cx_json_clone_func(CxJsonValue* target, const CxJsonValue* source,
-        const CxAllocator* allocator, cx_attr_unused void *data) {
+        const CxAllocator* allocator, CX_UNUSED void *data) {
     if (source == NULL || source->type == CX_JSON_NOTHING) {
         return &cx_json_value_nothing;
     }
@@ -1511,7 +1511,8 @@
             return ret; \
         } else { \
             *target = *ret; \
-            cxFree(allocator, ret); \
+            ret->type = CX_JSON_UNINITIALIZED; \
+            cxJsonValueFree(ret); \
             return target; \
         } \
     }

mercurial