mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +00:00
LibC: closedir() should free the readdir() buffer and the DIR itself.
This commit is contained in:
parent
c4e984ca49
commit
8ae7be611a
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
Add a link
Reference in a new issue