Free cJSON objects at the end of the test runner (fixes #2)

This commit is contained in:
2025-12-07 15:43:26 +01:00
parent c12c4c7bbf
commit 0182ee2beb
+2
View File
@@ -492,6 +492,7 @@ int main(void)
if (!cJSON_IsArray(root)) { if (!cJSON_IsArray(root)) {
fprintf(stderr, "Error: %s doesn't contain a JSON array as expected", path); fprintf(stderr, "Error: %s doesn't contain a JSON array as expected", path);
cJSON_Delete(root);
free(buf); free(buf);
return -1; return -1;
} }
@@ -544,6 +545,7 @@ int main(void)
printf(" failed : %d\n", num_failed); printf(" failed : %d\n", num_failed);
printf(" aborted: %d\n", num_aborted); printf(" aborted: %d\n", num_aborted);
cJSON_Delete(root);
free(buf); free(buf);
return 0; return 0;
} }