Closed Bug 1742010 Opened 3 years ago Closed 3 years ago

File descriptor leak when serializing into SurfaceDescriptorAndroidHardwareBuffer

Categories

(Core :: Graphics, defect, P3)

All
Android
defect

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/3881c4ca80d1b4b2f43be695438ecaf90ee4f86c/gfx/layers/opengl/TextureClientOGL.cpp#271
https://searchfox.org/mozilla-central/rev/3881c4ca80d1b4b2f43be695438ecaf90ee4f86c/gfx/layers/client/TextureClientSharedSurface.cpp#87

There is a footgun with ipc::FileDescriptor(readerFd.release()) where we pass a raw file descriptor due to the release() call. The constructor chosen actually dups the file handle, requiring us to free our own:

https://searchfox.org/mozilla-central/rev/3881c4ca80d1b4b2f43be695438ecaf90ee4f86c/ipc/glue/FileDescriptor.cpp#33

We should just do a move to avoid this.

We accidently duplicate the file descriptor when serializing because we
hit a constructor for ipc::FileDescriptor which duplicates the handle
instead of just taking it. This means we are supposed to close it
explicitly but we've already forgotten about it. We should just do a
move instead to avoid this.

Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9b6abfc76fd5 File descriptor leak when serializing into SurfaceDescriptorAndroidHardwareBuffer. r=sotaro,gfx-reviewers
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: