Edgar Grimberg fixes some memory handling issues and
a problem with arm7_9_debug_entry not executing a code path upon crashes. git-svn-id: svn://svn.berlios.de/openocd/trunk@669 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -347,6 +347,12 @@ int image_elf_read_headers(image_t *image)
|
||||
|
||||
elf->header = malloc(sizeof(Elf32_Ehdr));
|
||||
|
||||
if(elf->header == NULL)
|
||||
{
|
||||
LOG_ERROR("insufficient memory to perform operation ");
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
if ((retval = fileio_read(&elf->fileio, sizeof(Elf32_Ehdr), (u8*)elf->header, &read_bytes)) != ERROR_OK)
|
||||
{
|
||||
LOG_ERROR("cannot read ELF file header, read failed");
|
||||
@@ -392,6 +398,11 @@ int image_elf_read_headers(image_t *image)
|
||||
}
|
||||
|
||||
elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr));
|
||||
if(elf->segments == NULL)
|
||||
{
|
||||
LOG_ERROR("insufficient memory to perform operation ");
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
if ((retval = fileio_read(&elf->fileio, elf->segment_count*sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user