From 76e6375720d12a7784e4784bb08b2e0050bdcf45 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Wed, 24 Feb 2021 14:19:32 +0100 Subject: #1004 Fix memleak in og_cmd_images image_json object is created to store the json representation of an image returned by the database. This object is going to be appended to a json list that will compose the overall root json object. Use json_array_append_new to let "images" steal the reference of image_json so when further decref(root) there is no json reference hanging around. --- src/rest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rest.c b/src/rest.c index b67ea8e..57a97a5 100644 --- a/src/rest.c +++ b/src/rest.c @@ -1890,7 +1890,7 @@ static int og_cmd_images(char *buffer_reply) return -1; } - json_array_append(images, image_json); + json_array_append_new(images, image_json); } dbi_result_free(result); -- cgit v1.2.3-18-g5258