Fix CreateAnonymousSharedMemory() not to leak FILE when returning fd.
CreateAnonymousSharedMemory() was modified to return the writable memory
handle as a file-descriptor rather than as a FILE. Since POSIX does not
provide a standard way to teardown a FILE without also close()ing the
underlying file-descriptor, this was achieved by leaking the FILE.
We now provide CreateAndOpenFdForTemporaryFileInDir(), to avoid the need
to wrap the temporary-file descriptor into a FILE at all.
Bug: 814444, 736452
Change-Id: Idd911f50f0e506de3eac91c809efb6c6d59fec10
Reviewed-on: https://chromium-review.googlesource.com/930336
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538599}
CrOS-Libchrome-Original-Commit: 45a7b305282b175e11c871c1a8ac3b8336c66259
3 files changed