Issue 18332: _posix_listdir may leak FD (original) (raw)
Issue18332
This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/62532
classification
Title: | _posix_listdir may leak FD | ||
---|---|---|---|
Type: | resource usage | Stage: | needs patch |
Components: | Extension Modules | Versions: | Python 3.3, Python 3.4 |
process
Status: | closed | Resolution: | duplicate |
---|---|---|---|
Dependencies: | Superseder: | os.listdir() leaks FDs if invoked on FD pointing to a non-directory View:17899 | |
Assigned To: | Nosy List: | christian.heimes, sbt | |
Priority: | normal | Keywords: |
Created on 2013-06-30 16:47 by christian.heimes, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg192077 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2013-06-30 16:47 |
Under rare circumstances listdir() could leak a FD: - HAVE_FDOPENDIR is defined - dup(fd) succeeds - fdopendir() fails and sets dirp to NULL - if (dirp == NULL) goto exit - the dupped fd isn't closed because exit just handles dirp != NULL. Proposed fix: if (dirp != NULL) { ... } else if (fd != -1) { close(fd); } CID 992693 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_handle: Handle variable "fd" going out of scope leaks the handle | ||
msg192080 - (view) | Author: Richard Oudkerk (sbt) * ![]() |
Date: 2013-06-30 17:26 |
I think this is a duplicate of #17899. | ||
msg192082 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2013-06-30 17:43 |
You are right. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:47 | admin | set | github: 62532 |
2013-06-30 17:43:23 | christian.heimes | set | status: open -> closedsuperseder: os.listdir() leaks FDs if invoked on FD pointing to a non-directoryresolution: duplicatemessages: + |
2013-06-30 17:26:50 | sbt | set | nosy: + sbtmessages: + |
2013-06-30 16:47:57 | christian.heimes | create |
Supported by The Python Software Foundation,
Powered by Roundup
Copyright © 1990-2022, Python Software Foundation
Legal Statements