fix memory leak in Bluetooth*Manager::CompareHeaderTarget

RESOLVED FIXED in Firefox 45

Status

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

unspecified
2.6 S2 - 12/4

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
ObexHeaderSet::GetTarget copies the data associated with the
ObexHeaderId::Target id into a newly-allocated buffer.  All callers of
this function, however, fail to free the buffer once they are done with it.

Instead of simply freeing the buffer in the caller, however, let's add
an API to ObexHeaderSet that gives direct access to the desired header.
Doing this means that we have direct access to the data--no copying
necessary--and we also make the caller slightly faster, since it no
longer has to verify that the appropriate header is there, followed by
re-searching for the header it already knows is there.
(Assignee)

Comment 1

3 years ago
Created attachment 8686644 [details] [diff] [review]
fix memory leak in Bluetooth*Manager::CompareHeaderTarget
Attachment #8686644 - Flags: review?(btian)
Comment on attachment 8686644 [details] [diff] [review]
fix memory leak in Bluetooth*Manager::CompareHeaderTarget

Review of attachment 8686644 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with comment addressed.

::: dom/bluetooth/common/ObexBase.h
@@ +298,5 @@
>      // The specified parameter don't exist in 'Application Parameters' header.
>      return false;
>    }
>  
> +  const ObexHeader* HeaderOrNull(ObexHeaderId aId) const

Rename to |GetHeader|.
Attachment #8686644 - Flags: review?(btian) → review+

Comment 4

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/94dc62e0323e
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 2.6 S2 - 12/4
You need to log in before you can comment on or make changes to this bug.