fix memory leaks in json tests

Fri, 20 Dec 2024 15:15:18 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 20 Dec 2024 15:15:18 +0100
changeset 1032
aaad28e23dac
parent 1031
8a90552bba29
child 1033
e3009345984b

fix memory leaks in json tests

tests/test_json.c file | annotate | diff | comparison | revisions
--- a/tests/test_json.c	Fri Dec 20 15:00:31 2024 +0100
+++ b/tests/test_json.c	Fri Dec 20 15:15:18 2024 +0100
@@ -42,6 +42,7 @@
         CX_TEST_ASSERT(json.vbuf == json.vbuf_internal);
         CX_TEST_ASSERT(json.vbuf_size == 0);
         CX_TEST_ASSERT(json.vbuf_capacity >= 8);
+        cxJsonDestroy(&json);
     }
 }
 
@@ -137,6 +138,7 @@
             cxJsonAsCxString(object),
             CX_STR("{\n\t\"object\":null\n}"))
         );
+        cxJsonValueFree(obj);
     }
     cxJsonDestroy(&json);
 }
@@ -365,6 +367,7 @@
         CX_TEST_ASSERT(result == CX_JSON_NO_ERROR);
         CX_TEST_ASSERT(cxJsonIsNumber(v));
         CX_TEST_ASSERT(cxJsonAsDouble(v) == 0.000815);
+        cxJsonValueFree(v);
 
         cxJsonFill(&json, "1.23E4 ");
         result = cxJsonNext(&json, &v);
@@ -372,7 +375,6 @@
         CX_TEST_ASSERT(cxJsonIsNumber(v));
         CX_TEST_ASSERT(cxJsonAsInteger(v) == 12300);
         CX_TEST_ASSERT(cxJsonAsDouble(v) == 12300.0);
-
         cxJsonValueFree(v);
     }
     cxJsonDestroy(&json);

mercurial