anchao commented on code in PR #10676:
URL: https://github.com/apache/nuttx/pull/10676#discussion_r1328457786


##########
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);

Review Comment:
   1. modlib_loadhdrs() is a public function. All resources are better managed 
inside the function. If the call fails from internal, it is better to destroy 
by this function.
   2. I don't think delay free to modlib_unload() is a good practice, it will 
increase the lifetime of the memory being occupied



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to