summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/target/image.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/target/image.c b/src/target/image.c
index 39df4aef..df69f3a8 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -381,14 +381,12 @@ int image_elf_read_headers(image_t *image)
return ERROR_IMAGE_FORMAT_ERROR;
}
-
- if ((retval = fileio_seek(&elf->fileio, elf->header->e_phoff)) != ERROR_OK)
+ if ((retval = fileio_seek(&elf->fileio, field32(elf,elf->header->e_phoff))) != ERROR_OK)
{
ERROR("cannot seek to ELF program header table, read failed");
return retval;
}
-
elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr));
if ((retval = fileio_read(&elf->fileio, elf->segment_count*sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK)