Closed Bug 2051537 Opened 3 months ago Closed 3 months ago

Remove dead rv assignment in OpaqueResponseUtils.h

Categories

(Core :: Networking: HTTP, task)

task

Tracking

()

RESOLVED DUPLICATE of bug 2051536

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

The clang static analyzer (scan-build) found a dead assignment to rv in OpaqueResponseFilter::DetermineContentType. The return value of httpChannel->GetContentType(contentType) is stored in rv, but rv is never read afterwards (the code branches on contentType.IsEmpty() instead). That assignment is dead.

The fix is to call httpChannel->GetContentType(contentType); directly without assigning to rv.

Link to the code:
https://searchfox.org/mozilla-central/source/netwerk/protocol/http/OpaqueResponseUtils.h#175

To verify the fix:

./mach build netwerk/protocol/http

The change should not alter behavior: the result of GetContentType was already ignored; only the dead store is removed.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Status: NEW → RESOLVED
Closed: 3 months ago
Duplicate of bug: 2051536
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.