xiaoxiang781216 commented on code in PR #19639:
URL: https://github.com/apache/nuttx/pull/19639#discussion_r3710605883


##########
libs/libc/dlfcn/lib_dlclose.c:
##########
@@ -93,6 +95,22 @@ int dlclose(FAR void *handle)
    * dlremove() is essentially a clone of rmmod().
    */
 
+  /* Remove only once the last handle has been closed.  Under the registry
+   * lock for the same reason dlopen() counts under it; recursive, so
+   * libelf_remove() taking it again is fine.
+   */
+
+  libelf_registry_lock();
+
+  if (modp->nopen > 1)

Review Comment:
   it's better to move the dup check into libelf_insert, so inmod/rmmod could 
reuse the same code



-- 
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