Closed Bug 1231677 Opened 9 years ago Closed 9 years ago

[Static Analysis][Unchecked return value] In function MulticastDNSDeviceProvider::ForceDiscovery from MulticastDNSDeviceProvider.cpp

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox45 --- affected
firefox46 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1325947)

Attachments

(1 file)

The Static Analysis tool Coverity added that return value from mDiscoveryTimer->Init() is not checked. As it can bee seen from the code if that functions fails a waning message will be triggered:

>>  if (mIsDiscovering) {
>>    Unused << mDiscoveryTimer->Cancel();
>>
>>    NS_WARN_IF(NS_FAILED(mDiscoveryTimer->Init(this,
>>                                               mDiscveryTimeoutMs,
>>                                               nsITimer::TYPE_ONE_SHOT)));
>>    return NS_OK;
>>  }

Since the mDiscoveryTimer->Init function fails, i think we should also return the error code and stop the execution of the function and return to: MulticastDNSDeviceProvider::Init()

The code that i'm referring to, that verifies the status of ForceDiscovery is:
 
>>  Unused << mPresentationServer->SetId(mServiceName);
>>
>>  if (mDiscoveryEnabled && NS_WARN_IF(NS_FAILED(rv = ForceDiscovery()))) {
>>    return rv;
>>  }
Attached patch Bug 1231677.diffSplinter Review
Attachment #8697276 - Flags: review?(jst)
Attachment #8697276 - Flags: review?(jst) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/094fd5a4d3dc
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: