Bug 1049806 - b2g process leaks FDs. r=bent
authorJason Duell <jduell.mcbugs@gmail.com>
Mon, 11 Aug 2014 11:35:03 -0700
changeset 221820 a5e9d4753ede7a3472fb9e2136c595f983b64407
parent 221819 49086e9caa4eb3113778412ac0ba22596e92877d
child 221821 5976fbd55217219670cefb7a5e9903333a369f3b
push id583
push userbhearsum@mozilla.com
push dateMon, 24 Nov 2014 19:04:58 +0000
treeherdermozilla-release@c107e74250f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs1049806
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1049806 - b2g process leaks FDs. r=bent
netwerk/ipc/RemoteOpenFileParent.cpp
--- a/netwerk/ipc/RemoteOpenFileParent.cpp
+++ b/netwerk/ipc/RemoteOpenFileParent.cpp
@@ -42,16 +42,18 @@ RemoteOpenFileParent::OpenSendCloseDelet
 
   if (NS_SUCCEEDED(rv)) {
     int fd = open(path.get(), O_RDONLY);
     if (fd == -1) {
       printf_stderr("RemoteOpenFileParent: file '%s' was not found!\n",
                     path.get());
     } else {
       fileDescriptor = FileDescriptor(fd);
+      // FileDescriptor does a dup() internally, so we need to close our fd
+      close(fd);
     }
   }
 
   // Sending a potentially invalid file descriptor is just fine.
   unused << Send__delete__(this, fileDescriptor);
 
   if (fileDescriptor.IsValid()) {
     // close file now that other process has it open, else we'll leak fds in the