diff --git a/libs/libc/modlib/modlib_loadhdrs.c b/libs/libc/modlib/modlib_loadhdrs.c index 67ca77dd08..498b5054b0 100644 --- a/libs/libc/modlib/modlib_loadhdrs.c +++ b/libs/libc/modlib/modlib_loadhdrs.c @@ -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