summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-02-24 14:19:32 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-02-24 14:33:22 +0100
commit76e6375720d12a7784e4784bb08b2e0050bdcf45 (patch)
treec4756786b0f177f41e5d4e71f35e612156a94a70 /src/rest.c
parent1c52b78e72dade90f23cf9d41e7700648a10eee6 (diff)
#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.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c2
1 files changed, 1 insertions, 1 deletions
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);