am 54af78a3: Merge change 5950 into donut

Merge commit '54af78a3f7064e04d7ebd64c985d4149f9f7b05c'

* commit '54af78a3f7064e04d7ebd64c985d4149f9f7b05c':
  Fix memory leaks in system_server
This commit is contained in:
Android (Google) Code Review
2009-07-02 15:23:56 -07:00
committed by The Android Open Source Project
8 changed files with 41 additions and 6 deletions

View File

@@ -1883,7 +1883,9 @@ public class WifiService extends IWifiManager.Stub {
private WifiLock removeLock(IBinder binder) {
int index = findLockByBinder(binder);
if (index >= 0) {
return mList.remove(index);
WifiLock ret = mList.remove(index);
ret.unlinkDeathRecipient();
return ret;
} else {
return null;
}
@@ -1995,6 +1997,10 @@ public class WifiService extends IWifiManager.Stub {
binderDied();
}
}
void unlinkDeathRecipient() {
mBinder.unlinkToDeath(this, 0);
}
}
private class Multicaster extends DeathRecipient {
@@ -2062,7 +2068,10 @@ public class WifiService extends IWifiManager.Stub {
private void removeMulticasterLocked(int i, int uid)
{
mMulticasters.remove(i);
Multicaster removed = mMulticasters.remove(i);
if (removed != null) {
removed.unlinkDeathRecipient();
}
if (mMulticasters.size() == 0) {
WifiNative.startPacketFiltering();
}