mirror of
https://github.com/json-c/json-c.git
synced 2026-09-07 16:46:50 +08:00
fix json_object_put() to return 1 for freed scalars and empty containers
The iterative rewrite in 17328a67 made json_object_put() return 0 for freed scalars, strings and empty containers, contradicting the documented contract in json_object.h. Distinguish "freed" from "still referenced" in _json_object_put_maybe_free() and add regression tests.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
Parsed depth 100000 string to json_object: yes
|
||||
Freed json_object
|
||||
in user_delete, userdata_val=1
|
||||
put(empty object) returned 1
|
||||
put(empty array) returned 1
|
||||
put(string) returned 1
|
||||
put(int) returned 1
|
||||
put(non-empty object) returned 1
|
||||
put(still-referenced object) returned 0
|
||||
put(last reference) returned 1
|
||||
|
||||
Reference in New Issue
Block a user