diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-09 09:08:27 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-09 09:08:27 +0100 |
commit | 8ae7be611adee9bd1bb80fb8cbcce70007f38d47 (patch) | |
tree | bb5c31748605829efe862884a05021bef1c9a20c /LibC/dirent.cpp | |
parent | c4e984ca492e7ee95b66281bf86c9c58b5cb5392 (diff) | |
download | serenity-8ae7be611adee9bd1bb80fb8cbcce70007f38d47.zip |
LibC: closedir() should free the readdir() buffer and the DIR itself.
Diffstat (limited to 'LibC/dirent.cpp')
-rw-r--r-- | LibC/dirent.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/LibC/dirent.cpp b/LibC/dirent.cpp index 8f70166840..c511b9dad6 100644 --- a/LibC/dirent.cpp +++ b/LibC/dirent.cpp @@ -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; } |