main: Terminate immediately after image_alloc failure
This commit is contained in:
1 parent
45447099c9
commit
d4cd953018
1 file changed
+6
-8
+6
-8
@@ -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);
|
image = image_alloc_from_files(files, count, type, device, hwrevs, version, layout, image_parts);
|
||||||
free(files);
|
free(files);
|
||||||
|
free(layout);
|
||||||
|
|
||||||
|
if ( ! image ) {
|
||||||
|
ERROR("Cannot load image file %s", file);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
image_part = image_parts;
|
image_part = image_parts;
|
||||||
image_fd = image->fds;
|
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;
|
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);
|
image_list_add(image_first, image);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user