Bug 764773: Fix memory leak in UeventPoller. r=cjones
authorCervantes Yu <cyu@mozilla.com>
Mon, 18 Jun 2012 12:13:30 +0200
changeset 96918 a9542323655ef0ffad53487831fd480595dc53e7
parent 96917 a152c40b1fb19a9d746834bf7ad2fbe2a63325e8
child 96919 0ba224d850bd17040cf3bf128f613b1af5b9656c
push id10766
push userjacek@codeweavers.com
push dateMon, 18 Jun 2012 10:13:54 +0000
treeherdermozilla-inbound@a9542323655e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs764773
milestone16.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 764773: Fix memory leak in UeventPoller. r=cjones
hal/gonk/UeventPoller.cpp
--- a/hal/gonk/UeventPoller.cpp
+++ b/hal/gonk/UeventPoller.cpp
@@ -63,17 +63,16 @@ public:
       ShutdownUevent();  // this will destroy self
   }
 
 private:
   ScopedClose mSocket;
   MessageLoopForIO* mIOLoop;
   MessageLoopForIO::FileDescriptorWatcher mReadWatcher;
 
-  NetlinkEvent mNetlinkEvent;
   const static int kBuffsize = 64 * 1024;
   uint8_t mBuffer [kBuffsize];
 
   typedef ObserverList<NetlinkEvent> UeventObserverList;
   UeventObserverList mUeventObserverList;
 };
 
 bool
@@ -150,18 +149,19 @@ NetlinkPoller::OnFileCanReadWithoutBlock
       if (errno == EINTR) {
         continue;
       }
     }
     if (ret <= 0) {
       // fatal error on netlink socket which should not happen
       _exit(1);
     }
-    mNetlinkEvent.decode(reinterpret_cast<char*>(mBuffer), ret);
-    mUeventObserverList.Broadcast(mNetlinkEvent);
+    NetlinkEvent netlinkEvent;
+    netlinkEvent.decode(reinterpret_cast<char*>(mBuffer), ret);
+    mUeventObserverList.Broadcast(netlinkEvent);
   }
 }
 
 static void
 InitializeUevent()
 {
   MOZ_ASSERT(!sPoller);
   sPoller = new NetlinkPoller();