tests: Add missing json_decref() calls to suites/api/test_unpack.c

This commit is contained in:
Petri Lehtinen 2011-02-25 22:24:12 +02:00
parent dd9b4e530c
commit cd854b5bc2

View File

@ -134,6 +134,7 @@ int main()
if(!json_unpack_ex(NULL, &error, 0, "[i]")) if(!json_unpack_ex(NULL, &error, 0, "[i]"))
fail("json_unpack succeeded with NULL root"); fail("json_unpack succeeded with NULL root");
check_error("NULL root value", "<root>", -1, -1, 0); check_error("NULL root value", "<root>", -1, -1, 0);
json_decref(j);
/* mismatched open/close array/object */ /* mismatched open/close array/object */
j = json_pack("[]"); j = json_pack("[]");
@ -167,11 +168,13 @@ int main()
if(!json_unpack_ex(j, &error, 0, "[i]a", &i1)) if(!json_unpack_ex(j, &error, 0, "[i]a", &i1))
fail("json_unpack failed to catch garbage after format string"); fail("json_unpack failed to catch garbage after format string");
check_error("Garbage after format string", "<format>", 1, 4, 4); check_error("Garbage after format string", "<format>", 1, 4, 4);
json_decref(j);
j = json_integer(12345); j = json_integer(12345);
if(!json_unpack_ex(j, &error, 0, "ia", &i1)) if(!json_unpack_ex(j, &error, 0, "ia", &i1))
fail("json_unpack failed to catch garbage after format string"); fail("json_unpack failed to catch garbage after format string");
check_error("Garbage after format string", "<format>", 1, 2, 2); check_error("Garbage after format string", "<format>", 1, 2, 2);
json_decref(j);
/* NULL format string */ /* NULL format string */
j = json_pack("[]"); j = json_pack("[]");