Closed Bug 28064 Opened 20 years ago Closed 20 years ago

nsHTTPRequest memory leak

Categories

(Core :: Networking, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: jrohlf, Assigned: gagan)

Details

(Keywords: memory-leak)

In M13 nsHTTPRequest::WriteRequest():

fieldName is never deleted. I suspect it should be a 
nsXPIDLCString.

        while (bMoreHeaders) {
            enumerator->GetNext(getter_AddRefs(item));
            header = do_QueryInterface(item);

            NS_ASSERTION(header, "Bad HTTP header.");
            if (header) {
                header->GetField(getter_AddRefs(headerAtom));
                char* fieldName = nsnull;
                header->GetFieldName(&fieldName);
                NS_ASSERTION(fieldName, "field name not returned!, \
                        out of memory?");
                //if (!fieldName)
                    //return NS_ERROR_OUT_OF_MEMORY;
                mRequestBuffer.Append(fieldName);
                header->GetValue(getter_Copies(autoBuffer));

                mRequestBuffer.Append(": ");
                mRequestBuffer.Append(autoBuffer);
                mRequestBuffer.Append(CRLF);
            }
            enumerator->HasMoreElements(&bMoreHeaders);
        }
Target Milestone: M15
Keywords: mlk
Hmm.... not sure which version of this file you are looking at but there is a 
nsCRT::free(fieldName) at the bottom of the scope and no returns before that... 
Anyway I have made that an nsXPIDLCString to be consistent. 
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.