Closed
Bug 14067
Opened 25 years ago
Closed 25 years ago
[memory leak] Memory leak candidate
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
People
(Reporter: ftang, Assigned: rickg)
References
()
Details
The nsStr::EnsureCapacity function call theAgent-Realloc without checking the
return. Which may cause memory leak.
It will crash if it return NULL or value other than aString since the
theAgent->Realloc may free the origional aString
It will leak the newly allocate memory if the return value is different from
aString.
I have not see it leak form purify. Only whitebox review code let me enter this
bug.
111 void nsStr::EnsureCapacity(nsStr& aString,PRUint32
aNewLength,nsIMemoryAgent* anAgent) {
112 if(aNewLength>aString.mCapacity) {
113 nsIMemoryAgent* theAgent=(anAgent) ? anAgent : GetDefaultAgent();
114 theAgent->Realloc(aString,aNewLength);
115 AddNullTerminator(aString);
116 }
117 }
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
This is not a valid bug, but the problem where nsStr needs to be more defensive
in case of memory allocation failure is true. Marking as dup.
*** This bug has been marked as a duplicate of 12061 ***
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Updated•25 years ago
|
Status: RESOLVED → VERIFIED
Comment 3•25 years ago
|
||
verified duplicate of 12861
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•