Closed
Bug 25615
Opened 26 years ago
Closed 26 years ago
[MLK] nsStdURL leaking C strings
Categories
(Core :: Networking, defect, P3)
Core
Networking
Tracking
()
VERIFIED
FIXED
M14
People
(Reporter: beard, Assigned: andreas.otte)
References
()
Details
At the CVS blame URL above, you will see a call to DupString(&mRef, ...) where
mRef can already have a pointer to a C string in it, thus duping over it leaks
memory. There are a few other call sites to DupString() in this file that look
suspicious to me. The proof is that the following patch removes the memory leaks
that I'm observing with the Boehm leak detector:
Index: mozilla/netwerk/base/src/nsStdURL.cpp
===================================================================
RCS file: /cvsroot/mozilla/netwerk/base/src/nsStdURL.cpp,v
retrieving revision 1.39
diff -c -2 -r1.39 nsStdURL.cpp
*** nsStdURL.cpp 2000/01/28 07:40:31 1.39
--- nsStdURL.cpp 2000/01/29 03:04:29
***************
*** 824,827 ****
--- 824,828 ----
? and ; as well.
*/
+ CRTFREEIF(mRef);
nsresult status = DupString(&mRef,
(i_Ref && (*i_Ref == '#')) ? (i_Ref+1) : i_Ref);
***************
*** 832,835 ****
--- 833,837 ----
nsStdURL::SetParam(const char* i_Param)
{
+ CRTFREEIF(mParam);
nsresult status = DupString(&mParam,
(i_Param && (*i_Param == ';')) ? (i_Param+1) : i_Param);
***************
*** 840,843 ****
--- 842,846 ----
nsStdURL::SetQuery(const char* i_Query)
{
+ CRTFREEIF(mQuery);
nsresult status = DupString(&mQuery,
(i_Query && (*i_Query == '?')) ? (i_Query+1) : i_Query);
Comment 1•26 years ago
|
||
re-assign this to warren.
the reason my name was on the code was because I backed out warren.
cc'ing andreas as well.
Assignee: sspitzer → warren
Updated•26 years ago
|
Target Milestone: M14
| Assignee | ||
Comment 2•26 years ago
|
||
Already included in ANDREAS_URL2_BRANCH
| Assignee | ||
Comment 4•26 years ago
|
||
Yes, this CStrings no longer leak.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•