New submission from Christian Heimes: 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 ---------- components: Extension Modules messages: 192077 nosy: christian.heimes priority: normal severity: normal stage: needs patch status: open title: _posix_listdir may leak FD type: resource usage versions: Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18332> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com