tests: Add missing json_decref() calls to suites/api/test_unpack.c
authorPetri Lehtinen <petri@digip.org>
Fri, 25 Feb 2011 20:24:12 +0000 (22:24 +0200)
committerPetri Lehtinen <petri@digip.org>
Fri, 25 Feb 2011 20:24:12 +0000 (22:24 +0200)
test/suites/api/test_unpack.c

index b7935a8..cfc68ea 100644 (file)
@@ -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);
     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("[]");
 
     /* mismatched open/close array/object */
     j = json_pack("[]");
@@ -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);
     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);
 
     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("[]");
 
     /* NULL format string */
     j = json_pack("[]");