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.

Author christian.heimes
Recipients christian.heimes
Date 2013-06-30.16:47:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1372610877.27.0.117914198257.issue18332@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-06-30 16:47:57christian.heimessetrecipients: + christian.heimes
2013-06-30 16:47:57christian.heimessetmessageid: <1372610877.27.0.117914198257.issue18332@psf.upfronthosting.co.za>
2013-06-30 16:47:57christian.heimeslinkissue18332 messages
2013-06-30 16:47:56christian.heimescreate