runtime_loader: Fix memory leak in init_dependencies.
get_sorted_image_list allocates initList even if "count" winds up being 0, so we need to free it in this case also. Spotted by Coverity.
This commit is contained in:
@@ -306,7 +306,7 @@ relocate_dependencies(image_t *image)
|
|||||||
static void
|
static void
|
||||||
init_dependencies(image_t *image, bool initHead)
|
init_dependencies(image_t *image, bool initHead)
|
||||||
{
|
{
|
||||||
image_t **initList;
|
image_t **initList = NULL;
|
||||||
ssize_t count, i;
|
ssize_t count, i;
|
||||||
|
|
||||||
if (initHead && image->preinit_array) {
|
if (initHead && image->preinit_array) {
|
||||||
@@ -316,8 +316,10 @@ init_dependencies(image_t *image, bool initHead)
|
|||||||
}
|
}
|
||||||
|
|
||||||
count = get_sorted_image_list(image, &initList, RFLAG_INITIALIZED);
|
count = get_sorted_image_list(image, &initList, RFLAG_INITIALIZED);
|
||||||
if (count <= 0)
|
if (count <= 0) {
|
||||||
|
free(initList);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!initHead) {
|
if (!initHead) {
|
||||||
// this removes the "calling" image
|
// this removes the "calling" image
|
||||||
|
|||||||
Reference in New Issue
Block a user