binfmt: Fix .dtor memory allocation

Jira: PDFW15IS-265
Coverity-ID: 11053
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Yasuhiro Osaki 2014-09-11 09:44:09 +09:00 committed by Masayuki Ishikawa
parent 3633b5b6d5
commit b1008477ac

View File

@ -163,14 +163,14 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
{
/* Allocate memory to hold a copy of the .dtor section */
loadinfo->ctoralloc = (binfmt_dtor_t *)kumm_malloc(dtorsize);
if (!loadinfo->ctoralloc)
loadinfo->dtoralloc = (binfmt_dtor_t *)kumm_malloc(dtorsize);
if (!loadinfo->dtoralloc)
{
berr("Failed to allocate memory for .dtors\n");
return -ENOMEM;
}
loadinfo->dtors = (binfmt_dtor_t *)loadinfo->ctoralloc;
loadinfo->dtors = (binfmt_dtor_t *)loadinfo->dtoralloc;
/* Read the section header table into memory */