If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Mismatched allocators in nsStandardURL and nsDiskCacheMap

REOPENED

Status

()

Core
Networking
P3
normal
REOPENED
9 years ago
a month ago

People

(Reporter: neil@parkwaycc.co.uk, Assigned: neil@parkwaycc.co.uk)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-backlog])

Attachments

(2 attachments)

(Assignee)

Description

9 years ago
nsStandardURL uses free to free memory that may or may not have been allocated using malloc. I made all the allocations use the XPCOM allocator as the resulting string could then be Adopt()ed by the out parameter.

nsDiskCacheMap uses PR_FREEIF to free memory that was allocated with realloc. I decided it was easier just to change the allocator in that case.
(Assignee)

Comment 1

9 years ago
Created attachment 368408 [details] [diff] [review]
Proposed patch

I also got rid of the p/*result hacks.
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #368408 - Flags: superreview?(cbiesinger)
Attachment #368408 - Flags: review?(cbiesinger)
Attachment #368408 - Flags: superreview?(cbiesinger)
Attachment #368408 - Flags: superreview+
Attachment #368408 - Flags: review?(cbiesinger)
Attachment #368408 - Flags: review+
(Assignee)

Comment 2

9 years ago
Pushed changeset 6be239399910 to mozilla-central.
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Assignee)

Comment 3

9 years ago
I found a couple more mismatches.

The first is that mHostA is sometimes allocated using nsCRT::strdup and other times using ToNewCString. Presumably the reason it isn't an nsXPIDLCString is to save memory?

The second is that nsHttpBasicAuth uses calloc(!) for an XPCOM out parameter.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 4

9 years ago
Created attachment 369878 [details] [diff] [review]
nsXPIDLCString conversion

Not asking for review because you probably don't want this version.
Whiteboard: [necko-backlog]
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P1
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: P1 → P3
You need to log in before you can comment on or make changes to this bug.