mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
LibC: closedir() should free the readdir() buffer and the DIR itself.
This commit is contained in:
parent
c4e984ca49
commit
8ae7be611a
Notes:
sideshowbarker
2024-07-19 15:49:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8ae7be611ad
1 changed files with 3 additions and 0 deletions
|
@ -26,9 +26,12 @@ int closedir(DIR* dirp)
|
|||
{
|
||||
if (!dirp || dirp->fd == -1)
|
||||
return -EBADF;
|
||||
if (dirp->buffer)
|
||||
free(dirp->buffer);
|
||||
int rc = close(dirp->fd);
|
||||
if (rc == 0)
|
||||
dirp->fd = -1;
|
||||
free(dirp);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue