main: Terminate immediately after image_alloc failure

This commit is contained in:
Pali Rohár committed 2023-04-15 23:09:03 +02:00
1 parent 45447099c9
commit d4cd953018
1 file changed
+6 -8
+6 -8
View File
@@ -314,6 +314,12 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
image = image_alloc_from_files(files, count, type, device, hwrevs, version, layout, image_parts);
free(files);
free(layout);
if ( ! image ) {
ERROR("Cannot load image file %s", file);
exit(1);
}
image_part = image_parts;
image_fd = image->fds;
@@ -326,14 +332,6 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
image_fd = image_fd->next;
}
if ( layout )
free(layout);
if ( ! image ) {
ERROR("Cannot load image file %s", file);
exit(1);
}
image_list_add(image_first, image);
}