InitUserID() leaks ID string

RESOLVED FIXED

Status

()

Toolkit
Crash Reporting
RESOLVED FIXED
11 years ago
10 years ago

People

(Reporter: bz, Assigned: ted)

Tracking

({memory-leak})

unspecified
memory-leak
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.9 -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

463                       nsCAutoString id_str(id.ToString());

Leaks.  The header docs on ToString() say:

  Caller should free string.

Note that the best way to fix this depends on what happens in bug 392526.
Flags: blocking1.9?

Updated

11 years ago
Flags: blocking1.9? → blocking1.9-
Ted: Could you have a look at this, should be an easy fix.
Assignee: nobody → ted.mielczarek
(Assignee)

Comment 2

10 years ago
Created attachment 286006 [details] [diff] [review]
PR_Free the pointer

Simple fix.
Attachment #286006 - Flags: review?(benjamin)

Comment 3

10 years ago
Comment on attachment 286006 [details] [diff] [review]
PR_Free the pointer

You want nsAdoptingCString, I think.
Attachment #286006 - Flags: review?(benjamin) → review-
(Assignee)

Comment 4

10 years ago
is that true?  In bug 392526 bz said:
"2)  The function uses an allocator which is not necessarily compatible with
    XPCOM strings (though in the common case it is).  As a result, Adopt() of
    this string is wrong."

Comment 5

10 years ago
well shoot, we shoulda fixed bug 331165 already :-(

You should be able to skip the nsCAutostring copy and do something like

nsDependentCString id_str(id_cstr);
(Assignee)

Comment 6

10 years ago
Created attachment 286750 [details] [diff] [review]
+ nsDependentCString

Same thing, but using nsDependentCString.
Attachment #286006 - Attachment is obsolete: true
Attachment #286750 - Flags: review?(benjamin)

Updated

10 years ago
Attachment #286750 - Flags: review?(benjamin) → review+
(Assignee)

Comment 7

10 years ago
Comment on attachment 286750 [details] [diff] [review]
+ nsDependentCString

Looking for approval, just a simple leak fix.
Attachment #286750 - Flags: approval1.9?

Updated

10 years ago
Attachment #286750 - Flags: approval1.9? → approval1.9+
(Assignee)

Comment 8

10 years ago
Checked in.
Assignee: ted.mielczarek → nobody
(Assignee)

Updated

10 years ago
Assignee: nobody → ted.mielczarek
(Assignee)

Updated

10 years ago
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.