#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.
master
Jose M. Guisado 2021-02-24 14:19:32 +01:00 committed by OpenGnSys Support Team
parent 1c52b78e72
commit 76e6375720
1 changed files with 1 additions and 1 deletions

View File

@ -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);