Skip to content

Commit

Permalink
tests: Add missing json_decref() calls to suites/api/test_unpack.c
Browse files Browse the repository at this point in the history
  • Loading branch information
akheron committed Feb 25, 2011
1 parent dd9b4e5 commit cd854b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/suites/api/test_unpack.c
Expand Up @@ -134,6 +134,7 @@ int main()
if(!json_unpack_ex(NULL, &error, 0, "[i]"))
fail("json_unpack succeeded with NULL root");
check_error("NULL root value", "<root>", -1, -1, 0);
json_decref(j);

/* mismatched open/close array/object */
j = json_pack("[]");
Expand Down Expand Up @@ -167,11 +168,13 @@ int main()
if(!json_unpack_ex(j, &error, 0, "[i]a", &i1))
fail("json_unpack failed to catch garbage after format string");
check_error("Garbage after format string", "<format>", 1, 4, 4);
json_decref(j);

j = json_integer(12345);
if(!json_unpack_ex(j, &error, 0, "ia", &i1))
fail("json_unpack failed to catch garbage after format string");
check_error("Garbage after format string", "<format>", 1, 2, 2);
json_decref(j);

/* NULL format string */
j = json_pack("[]");
Expand Down

0 comments on commit cd854b5

Please sign in to comment.