Closed Bug 484312 Opened 12 years ago Closed 5 months ago

Mismatched allocators in nsStandardURL and nsDiskCacheMap

Categories

(Core :: Networking, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: neil, Assigned: neil)

Details

(Whiteboard: [necko-backlog])

Attachments

(2 files)

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.
Attached patch Proposed patchSplinter Review
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+
Pushed changeset 6be239399910 to mozilla-central.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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 → ---
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

Doesn't seem to be the case anymore.

Status: REOPENED → RESOLVED
Closed: 12 years ago5 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.