libs/modlib: avoid double free when call modlib_unload with erro
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
310ba09ed7
commit
e8c9541263
@ -116,7 +116,6 @@ int modlib_loadhdrs(FAR struct mod_loadinfo_s *loadinfo)
|
||||
loadinfo->phdr = (FAR Elf_Phdr *)lib_malloc(phdrsize);
|
||||
if (!loadinfo->phdr)
|
||||
{
|
||||
lib_free(loadinfo->shdr);
|
||||
berr("ERROR: Failed to allocate the program header table."
|
||||
"Size: %zu\n", phdrsize);
|
||||
return -ENOMEM;
|
||||
@ -129,8 +128,6 @@ int modlib_loadhdrs(FAR struct mod_loadinfo_s *loadinfo)
|
||||
if (ret < 0)
|
||||
{
|
||||
berr("ERROR: Failed to read program header table: %d\n", ret);
|
||||
lib_free(loadinfo->phdr);
|
||||
lib_free(loadinfo->shdr);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user