Closed Bug 2051536 Opened 3 months ago Closed 24 days ago

Remove dead rv assignment in OpaqueResponseUtils.h

Categories

(Core :: Networking: HTTP, task, P3)

task

Tracking

()

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: Sylvestre, Assigned: gustavokrm, Mentored)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 file)

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.

Duplicate of this bug: 2051537
Mentor: sledru
Severity: -- → S4
Priority: -- → P3
Whiteboard: [lang=c++] → [lang=c++], [necko-triaged]
Assignee: nobody → gustavokrm
Status: NEW → ASSIGNED
Attachment #9639180 - Attachment description: Bug 2051536 r?#necko-reviewers Remove dead rv assignment in OpaqueResponseUtils.h → Bug 2051536 - Remove dead rv assignment in OpaqueResponseUtils.h r?#necko-reviewers
Pushed by valentin.gosu@gmail.com: https://github.com/mozilla-firefox/firefox/commit/4e737be215ef https://hg.mozilla.org/integration/autoland/rev/43f7b82f305d Remove dead rv assignment in OpaqueResponseUtils.h r=necko-reviewers,leggert,valentin
Status: ASSIGNED → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch
QA Whiteboard: [qa-triage-done-c158/b157]
You need to log in before you can comment on or make changes to this bug.