libc/elf: Free the registry entry when removing a module.

libelf_remove() takes the module out of the registry but never frees
the registry entry, so every successful rmmod()/dlclose() leaks
sizeof(struct module_s), the name included.  The lib_free() call was
dropped by e9550783d3 when the removal path was reworked.

Free the entry after the registry lock is released.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
yushuailong 2026-09-16 15:51:04 +08:00 • committed by Xiang Xiao
parent 7c02367483
commit a9683532b5

View file

@ -240,6 +240,8 @@ int libelf_remove(FAR void *handle)
/* And free the registry entry */
lib_free(modp);
return ret;
errout_with_lock: