Made sure that iso_file_get_old_image_sections() returns non-NULL only
if section_count > 0. Made sure that callers in libisofs expect all possible outcome as announced by API description.
This commit is contained in:
@@ -1193,16 +1193,17 @@ int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag)
|
||||
{
|
||||
int ret;
|
||||
int section_count;
|
||||
struct iso_file_section *sections;
|
||||
struct iso_file_section *sections = NULL;
|
||||
|
||||
if (file == NULL || lba == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
ret = iso_file_get_old_image_sections(file, §ion_count, §ions, flag);
|
||||
if (ret <= 0) {
|
||||
ret = iso_file_get_old_image_sections(file, §ion_count, §ions, 0);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
}
|
||||
if (section_count != 1) {
|
||||
free(sections);
|
||||
if (sections != NULL)
|
||||
free(sections);
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
*lba = sections[0].block;
|
||||
@@ -1211,7 +1212,6 @@ int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Like iso_file_get_old_image_lba(), but take an IsoNode.
|
||||
*
|
||||
|
Reference in New Issue
Block a user