fix memory leaks

Sun, 26 Jan 2025 13:22:58 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 26 Jan 2025 13:22:58 +0100
changeset 1157
3565ae61a5a2
parent 1156
96f16b5a0029
child 1158
fa2811e9ab19

fix memory leaks

tests/test_json.c file | annotate | diff | comparison | revisions
--- a/tests/test_json.c	Sun Jan 26 13:20:05 2025 +0100
+++ b/tests/test_json.c	Sun Jan 26 13:22:58 2025 +0100
@@ -145,7 +145,7 @@
             cxJsonAsCxString(ctrl),
             CX_STR("\\foo\r\nbar\f*ring/ring*\b"))
         );
-        cxJsonValueFree(ctrl);
+        cxJsonValueFree(obj);
     }
     cxJsonDestroy(&json);
 }
@@ -240,6 +240,7 @@
             cxJsonAsCxString(obj),
             CX_STR("too few \\u123 digits")
         ));
+        cxJsonValueFree(obj);
         cxJsonFill(&json, "\"too many \\u00E456 digits\"");
         result = cxJsonNext(&json, &obj);
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
@@ -248,6 +249,7 @@
             cxJsonAsCxString(obj),
             CX_STR("too many รค56 digits")
         ));
+        cxJsonValueFree(obj);
         cxJsonFill(&json, "\"only high \\uD800 surrogate\"");
         result = cxJsonNext(&json, &obj);
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
@@ -256,6 +258,7 @@
             cxJsonAsCxString(obj),
             CX_STR("only high \\uD800 surrogate")
         ));
+        cxJsonValueFree(obj);
         cxJsonFill(&json, "\"only low \\uDC00 surrogate\"");
         result = cxJsonNext(&json, &obj);
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
@@ -264,6 +267,7 @@
             cxJsonAsCxString(obj),
             CX_STR("only low \\uDC00 surrogate")
         ));
+        cxJsonValueFree(obj);
         cxJsonFill(&json, "\"two high \\uD800\\uD800 surrogates\"");
         result = cxJsonNext(&json, &obj);
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
@@ -272,6 +276,7 @@
             cxJsonAsCxString(obj),
             CX_STR("two high \\uD800\\uD800 surrogates")
         ));
+        cxJsonValueFree(obj);
         cxJsonFill(&json, "\"high plus bullshit \\uD800\\u567 foo\"");
         result = cxJsonNext(&json, &obj);
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
@@ -280,6 +285,7 @@
             cxJsonAsCxString(obj),
             CX_STR("high plus bullshit \\uD800\\u567 foo")
         ));
+        cxJsonValueFree(obj);
     }
     cxJsonDestroy(&json);
 }

mercurial