Closed Bug 1224240 Opened 4 years ago Closed 4 years ago

fix memory leak in Bluetooth*Manager::CompareHeaderTarget

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

defect
Not set

Tracking

(firefox45 fixed)

RESOLVED FIXED
2.6 S2 - 12/4
Tracking Status
firefox45 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

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.
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+
https://hg.mozilla.org/mozilla-central/rev/94dc62e0323e
Status: NEW → RESOLVED
Closed: 4 years ago
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.