grub-mkimage: fix potential NULL pointer dereference

Move fatal check whether symtab_section is NULL before first reference.

Found by: Coverity scan.
This commit is contained in:
Andrei Borzenkov 2015-01-30 22:26:05 +03:00
parent b40fde29a4
commit 7aaed66455

View file

@ -1539,6 +1539,8 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
symtab_section = s;
break;
}
if (! symtab_section)
grub_util_error ("%s", _("no symbol table"));
#ifdef MKIMAGE_ELF32
if (image_target->elf_target == EM_ARM)
@ -1577,8 +1579,6 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
}
#endif
if (! symtab_section)
grub_util_error ("%s", _("no symbol table"));
}
else
{