Bug 1003657 - Don't keep reference in GetDefaultAdapterPathInternal() to avoid memory leak. r=echou, f=shuang

This commit is contained in:
Jamin Liu 2014-05-06 11:45:51 +08:00
parent 927c7f8264
commit fcc15cdd85

View File

@ -772,8 +772,6 @@ BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
{
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
BluetoothValue v = InfallibleTArray<BluetoothNamedValue>();
BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
@ -791,10 +789,7 @@ BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
"Devices", sAdapterBondedAddressArray);
nsAutoString replyError;
DispatchBluetoothReply(runnable.get(), v, replyError);
unused << runnable.forget(); // picked up in DispatchBluetoothReply
DispatchBluetoothReply(aRunnable, v, EmptyString());
return NS_OK;
}