Bug 1231677 - verify the return of mDiscoveryTimer->Init, if it faild exit function with error code. r=jst

This commit is contained in:
Bogdan Postelnicu 2015-12-10 07:56:00 +01:00
parent 16c1e2b2cc
commit e0946ac595

View File

@ -576,18 +576,20 @@ MulticastDNSDeviceProvider::ForceDiscovery()
MOZ_ASSERT(mMulticastDNS);
// if it's already discovering, extend existing discovery timeout.
nsresult rv;
if (mIsDiscovering) {
Unused << mDiscoveryTimer->Cancel();
NS_WARN_IF(NS_FAILED(mDiscoveryTimer->Init(this,
mDiscveryTimeoutMs,
nsITimer::TYPE_ONE_SHOT)));
if (NS_WARN_IF(NS_FAILED( rv = mDiscoveryTimer->Init(this,
mDiscveryTimeoutMs,
nsITimer::TYPE_ONE_SHOT)))) {
return rv;
}
return NS_OK;
}
StopDiscovery(NS_OK);
nsresult rv;
if (NS_WARN_IF(NS_FAILED(rv = mMulticastDNS->StartDiscovery(
NS_LITERAL_CSTRING(SERVICE_TYPE),
mWrappedListener,