Closed
Bug 1516558
Opened 5 years ago
Closed 3 years ago
Memory leak in WriteExtraForMinidump due to fdopen without fclose
Categories
(Toolkit :: Crash Reporting, enhancement)
Toolkit
Crash Reporting
Tracking
()
RESOLVED
FIXED
People
(Reporter: jld, Unassigned)
References
Details
WriteExtraForMinidump uses fdopen() to create a FILE* that references the same underlying object as a given PRFileDesc*; it closes the PRFileDesc but not the FILE. As pointed out in bug 1438106, this is intentional, because both the PRFileDesc and FILE will close the fd/handle, so closing both would be a double-close error. However, leaking the FILE* would mean we're leaking all of its heap allocations. (I haven't confirmed this with leak-checking tools, but I can't see how it could fail to be a leak.) One way to fix this is to duplicate the file descriptor; Windows seems to have _dup for fds, and we also have a cross-platform abstraction of a duplicatable fd/handle in mozilla::ipc::FileDescriptor (and conversions to/from FILE* in FileDescriptorUtils.h). The other way is to change ReadAndValidateExceptionTimeAnnotations to use NSPR I/O, and I don't know if NSPR has anything like fgets for “read a line”.
Comment 1•3 years ago
|
||
This was fixed in bug 1547698 by switching everything to NSPR I/O.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•