Fix misuses of free() as the deallocator in PSM

RESOLVED FIXED in Firefox 50

Status

()

Core
Security: PSM
P1
normal
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: Cykesiopka, Assigned: Cykesiopka)

Tracking

unspecified
mozilla50
Points:
---

Firefox Tracking Flags

(firefox50 fixed)

Details

(Whiteboard: [psm-assigned])

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

a year ago
There are a few places in PSM where free() is used to free memory allocated by NSS instead of PORT_Free() (or higher level deallocation functions that end up calling PORT_Free()).

In practice, PORT_Free() is just a wrapper around PR_Free(), which is just a wrapper around free() if we don't ask NSPR to a zone allocator.

Gecko explicitly tells NSPR not to use a zone allocator: https://hg.mozilla.org/mozilla-central/file/51377a64158941f89ed73f388ae437cfa494c030/toolkit/xre/nsAppRunner.cpp#l3020
> NS_VISIBILITY_DEFAULT PRBool nspr_use_zone_allocator = PR_FALSE;
... so the changes here are mainly for making the code more obviously correct.
(Assignee)

Comment 1

a year ago
Created attachment 8764350 [details]
Bug 1281564 - Fix misuses of free() as the deallocator in PSM.

There are a few places in PSM where free() is used to free memory allocated by
NSS instead of PORT_Free() (or higher level deallocation functions that end up
calling PORT_Free()).

In practice, PORT_Free() is just a wrapper around PR_Free(), which is just a
wrapper around free() if we don't ask NSPR to a zone allocator.
Gecko explicitly tells NSPR not to use a zone allocator, so the changes here are
mainly for making the code more obviously correct.

This patch also includes some misc cleanup.

Review commit: https://reviewboard.mozilla.org/r/60300/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/60300/
Attachment #8764350 - Flags: review?(dkeeler)
Attachment #8764350 - Flags: review?(dkeeler) → review+
Comment on attachment 8764350 [details]
Bug 1281564 - Fix misuses of free() as the deallocator in PSM.

https://reviewboard.mozilla.org/r/60300/#review57116

Great - r=me
(Assignee)

Comment 3

a year ago
Comment on attachment 8764350 [details]
Bug 1281564 - Fix misuses of free() as the deallocator in PSM.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60300/diff/1-2/
(Assignee)

Comment 4

a year ago
Thanks!

https://treeherder.mozilla.org/#/jobs?repo=try&revision=0d5a4e8a1a8b
Keywords: checkin-needed

Comment 5

a year ago
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bd503b1c36f3
Fix misuses of free() as the deallocator in PSM. r=keeler
Keywords: checkin-needed

Comment 6

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/bd503b1c36f3
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox50: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.