Sun, 03 Nov 2024 09:57:17 +0100
fix memory leaks in json tests
tests/test_json.c | file | annotate | diff | comparison | revisions |
--- a/tests/test_json.c Sun Nov 03 09:56:33 2024 +0100 +++ b/tests/test_json.c Sun Nov 03 09:57:17 2024 +0100 @@ -242,6 +242,7 @@ CX_TEST_ASSERT(json.states != json.states_internal); CX_TEST_ASSERT(json.states_alloc > cx_nmemb(json.states_internal)); + cxJsonValueFree(d1); cxJsonDestroy(&json); } } @@ -258,11 +259,13 @@ CX_TEST_ASSERT(result == 1); CX_TEST_ASSERT(cxJsonIsNumber(v)); CX_TEST_ASSERT(cxJsonAsDouble(v) == 3.1415); + cxJsonValueFree(v); cxJsonFill(&json, "-47.11e2 "); result = cxJsonNext(&json, &v); CX_TEST_ASSERT(result == 1); CX_TEST_ASSERT(cxJsonIsNumber(v)); CX_TEST_ASSERT(cxJsonAsDouble(v) == -4711.0); + cxJsonValueFree(v); } cxJsonDestroy(&json); }