sbverify: Check for failed image load

Currently, sbverify will segfault when it can't load an image file, as
the image is used unconditionally. This change adds a check to ensure we
continue with a valid image pointer.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-06-13 17:27:59 +08:00
parent 0568983fab
commit 186f1d59d9

View file

@ -234,6 +234,11 @@ int main(int argc, char **argv)
}
image = image_load(argv[optind]);
if (!image) {
fprintf(stderr, "Can't open image %s\n", argv[optind]);
return EXIT_FAILURE;
}
image_pecoff_parse(image);
image_find_regions(image);