Fix memory leaks in json_equal() tests

This commit is contained in:
Petri Lehtinen 2010-01-10 21:01:59 +02:00
parent 93ac06c902
commit 7f8684828d

View File

@ -137,12 +137,12 @@ static void test_equal_object()
if(json_equal(object1, object2)) if(json_equal(object1, object2))
fail("json_equal fails for two inequal objects"); fail("json_equal fails for two inequal objects");
json_object_set(object2, "c", json_integer(3)); json_object_set_new(object2, "c", json_integer(3));
if(json_equal(object1, object2)) if(json_equal(object1, object2))
fail("json_equal fails for two inequal objects"); fail("json_equal fails for two inequal objects");
json_object_del(object2, "c"); json_object_del(object2, "c");
json_object_set(object2, "d", json_integer(2)); json_object_set_new(object2, "d", json_integer(2));
if(json_equal(object1, object2)) if(json_equal(object1, object2))
fail("json_equal fails for two inequal objects"); fail("json_equal fails for two inequal objects");
@ -174,6 +174,9 @@ static void test_equal_complex()
if(!json_equal(value1, value2)) if(!json_equal(value1, value2))
fail("json_equal fails for two inequal strings"); fail("json_equal fails for two inequal strings");
json_decref(value1);
json_decref(value2);
/* TODO: There's no negative test case here */ /* TODO: There's no negative test case here */
} }