aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaer-Olof Haakansson <par-olof.hakansson@stericsson.com>2011-11-15 15:40:15 +0100
committerPar-Olof HAKANSSON <par-olof.hakansson@stericsson.com>2011-11-15 15:56:32 +0100
commitef0b1a06e5e6aa3dd07afbf3f7e1ef9c4c42ac5c (patch)
tree77471174b61b506f6cdeefd66930e434389c888e
parent5063a2c6433dd97079e4b9c039a101eb5f16e112 (diff)
downloadu-boot-ux500-ef0b1a06e5e6aa3dd07afbf3f7e1ef9c4c42ac5c.tar.gz
u8500: Fix of coverity errors in dump handler
Fixes missing check of NULL pointer after malloc and trivial missing free of data. ST-Ericsson ID: 365050 ST-Ericsson FOSS-OUT ID: NA Change-Id: I0d2c0d6cc2fffaf7ffeec97742134c4814b3e7aa Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/37842 Reviewed-by: Per FRANSSON <per.xx.fransson@stericsson.com> Reviewed-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com> Tested-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com>
-rw-r--r--board/st-ericsson/u8500/cmd_cdump.c5
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: