pspdev / newlib

A fork of newlib for the PSP.
GNU General Public License v2.0
8 stars 5 forks source link

Fix scandir DD_LOCK #12

Closed fjtrujy closed 5 months ago

fjtrujy commented 5 months ago

Description

Be sure the __lock_release_recursive(dirp->dd_lock); is being called before the closedir(dirp); otherwise it will crash as the dirp->dd_lock is going to be deleted in closedir and on top of that the dirp is freed also in closedir.

This issue has been there in newlib for years, however, it wasn't noticed because first of all LOCK API looks to be barely used, and secondly because it also requires the flag HAVE_DD_LOCK to be enabled.

Cheers.