diff options
-rw-r--r-- | board/st-ericsson/u8500/cmd_cdump.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/board/st-ericsson/u8500/cmd_cdump.c b/board/st-ericsson/u8500/cmd_cdump.c index 645a554e9..c7e5605ac 100644 --- a/board/st-ericsson/u8500/cmd_cdump.c +++ b/board/st-ericsson/u8500/cmd_cdump.c @@ -453,11 +453,13 @@ Elf32_Ehdr *create_elfhdr(range_t *regions, unsigned int region_no) { unsigned int i; hdr_size = sizeof(*ehdr)+(region_no+1)*sizeof(*phdr); - ehdr = memset(malloc(hdr_size), 0, hdr_size); + ehdr = malloc(hdr_size); if(ehdr == NULL) { return NULL; } + memset(ehdr, 0, hdr_size); + ehdr->e_ident[EI_MAG0] = ELFMAG0; ehdr->e_ident[EI_MAG1] = ELFMAG1; ehdr->e_ident[EI_MAG2] = ELFMAG2; @@ -665,6 +667,7 @@ int dump_regions_from_environment(void) rc = 1; } + free(elfhdr_addr); out1: free(regions); out2: |