mirror of
https://github.com/json-c/json-c.git
synced 2026-03-13 18:19:06 +08:00
Add test to check for the memory leak mentioned in issue #781
This commit is contained in:
@@ -71,6 +71,14 @@ int main(int argc, char **argv)
|
||||
json_object_set_string(tmp, SHORT);
|
||||
assert(strcmp(json_object_get_string(tmp), SHORT) == 0);
|
||||
assert(strcmp(json_object_to_json_string(tmp), "\"" SHORT "\"") == 0);
|
||||
|
||||
// Set an empty string a couple times to try to trigger
|
||||
// a case that used to leak memory.
|
||||
json_object_set_string(tmp, "");
|
||||
json_object_set_string(tmp, HUGE);
|
||||
json_object_set_string(tmp, "");
|
||||
json_object_set_string(tmp, HUGE);
|
||||
|
||||
json_object_put(tmp);
|
||||
printf("STRING PASSED\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user