libdfu: Fix a crash if elf32_newehdr() fails

This commit is contained in:
Richard Hughes 2017-07-21 13:07:00 +01:00
parent 061ad8c5e8
commit c3c50fba4c

View File

@ -386,7 +386,10 @@ dfu_firmware_to_elf (DfuFirmware *firmware, GError **error)
/* add executable header */
ehdr = elf32_newehdr (e);
if (ehdr == NULL) {
g_warning ("failed to create executable header: %s",
g_set_error (error,
DFU_ERROR,
DFU_ERROR_INTERNAL,
"failed to create executable header: %s",
elf_errmsg (-1));
return NULL;
}