Made sure that missing boot catalog at image load time causes no SIGSEGV

by NULL. Coverity CID 12552.
This commit is contained in:
Thomas Schmitt 2015-10-11 18:25:13 +02:00
parent ccef2f29da
commit 505bf23aa4

View File

@ -4851,20 +4851,22 @@ int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block,
sai->apm_req[i]->block_count) / sai->apm_req[i]->block_count) /
(2048 / sai->apm_block_size))); (2048 / sai->apm_block_size)));
} }
if (image->bootcat != NULL) if (image->bootcat != NULL) {
if (image->bootcat->node != NULL) if (image->bootcat->node != NULL)
iso_impsysa_reduce_na(block, next_above, image->bootcat->node->lba); iso_impsysa_reduce_na(block, next_above,
image->bootcat->node->lba);
for (i= 0; i < image->bootcat->num_bootimages; i++) { for (i= 0; i < image->bootcat->num_bootimages; i++) {
img = image->bootcat->bootimages[i]; img = image->bootcat->bootimages[i];
ret = iso_file_get_old_image_sections(img->image, &section_count, ret = iso_file_get_old_image_sections(img->image, &section_count,
&sections, 0); &sections, 0);
if (ret > 0 && section_count > 0) if (ret > 0 && section_count > 0)
if (block != sections[0].block) if (block != sections[0].block)
iso_impsysa_reduce_na(block, next_above, sections[0].block); iso_impsysa_reduce_na(block, next_above,
if (sections != NULL) { sections[0].block);
free(sections); if (sections != NULL) {
sections = NULL; free(sections);
sections = NULL;
}
} }
} }