Closed Bug 1535357 Opened 5 years ago Closed 5 years ago

Make nsHttpConnectionInfo::Clone() return already_AddRefed<>

Categories

(Core :: Networking: HTTP, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

I looked at Valentin's patch in bug 1512472, and went through and checked every other place we create a nsHttpConnectionInfo. The Clone method also assigns to a raw pointer. The code as it is looks okay to me, but it could be made more robust by assigning into a RefPtr and returning an already_AddRefed or RefPtr. This will require a minor change to the caller in nsHttpConnectionInfo::CloneAsDirectRoute(), but I think the rest of the callers should work as-is.

This will make it harder for callers of this method to accidentally
leak the connection info.

Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/be4af23f4c1a
Make nsHttpConnectionInfo::Clone() return already_AddRefed<>. r=valentin
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: