From 93ac06c902cd9518fc467c1e40c6bd46c4ee0d0c Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Sun, 10 Jan 2010 21:01:07 +0200 Subject: [PATCH] Fix memory leaks in json_*_deep_copy() --- src/value.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value.c b/src/value.c index e118af1..01e180e 100644 --- a/src/value.c +++ b/src/value.c @@ -285,7 +285,7 @@ static json_t *json_object_deep_copy(json_t *object) key = json_object_iter_key(iter); value = json_object_iter_value(iter); - json_object_set_nocheck(result, key, json_deep_copy(value)); + json_object_set_new_nocheck(result, key, json_deep_copy(value)); iter = json_object_iter_next(object, iter); } @@ -586,7 +586,7 @@ static json_t *json_array_deep_copy(json_t *array) return NULL; for(i = 0; i < json_array_size(array); i++) - json_array_append(result, json_deep_copy(json_array_get(array, i))); + json_array_append_new(result, json_deep_copy(json_array_get(array, i))); return result; }