Closed Bug 3731 Opened 26 years ago Closed 26 years ago

MLK: Leaking HTTP URLs.

Categories

(Core :: Networking, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bruce, Assigned: gagan)

Details

(Whiteboard: waiting for reporter's OK)

Build/pull from March 14, 1999. MLK: 240 bytes leaked in 3 blocks * This memory was allocated from: malloc [rtlib.o] __bUiLtIn_nEw [libgcc.a] __builtin_new [rtlib.o] nsHttpURLFactory::CreateURL(nsIURL**,const nsString&,const nsIURL*,nsISupports*,nsIURLGroup*) [nsHttpURLFactory.cpp:70] nsNetlibService::CreateURL(nsIURL**,const nsString&,const nsIURL*,nsISupports*,nsIURLGroup*) [nsNetService.cpp:1040] NS_NewURL(nsIURL**,const nsString&,const nsIURL*,nsISupports*,nsIURLGroup*) [nsNetService.cpp:1107] NS_MakeAbsoluteURL(nsIURL*,const nsString&,const nsString&,nsString&) [nsNetService.cpp:1130] SelectorMatches(nsIPresContext*,nsCSSSelector*,nsIContent*) [nsCSSStyleSheet.cpp:1135] ContentEnumFunc(nsICSSStyleRule*,void*) [nsCSSStyleSheet.cpp:1249] RuleHash::EnumerateAllRules(nsIAtom*,nsIAtom*,const nsVoidArray&,void(*)(nsICSSStyleRule*,void*),void*) [nsCSSStyleSheet.cpp:307] CSSStyleSheetImpl::RulesMatching(nsIPresContext*,nsIContent*,nsIStyleContext*,ns ISupportsArray*) [nsCSSStyleSheet.cpp:1331] StyleSetImpl::RulesMatching(nsISupportsArray*,nsIPresContext*,nsIAtom*,nsIConten t*,nsIStyleContext*,nsISupportsArray*) [nsStyleSet.cpp:419] StyleSetImpl::ResolveStyleFor(nsIPresContext*,nsIContent*,nsIStyleContext*,int) [nsStyleSet.cpp:536] nsPresContext::ResolveStyleContextFor(nsIContent*,nsIStyleContext*,int,nsIStyleC ontext**) [nsPresContext.cpp:384] nsCSSFrameConstructor::ResolveStyleContext(nsIPresContext*,nsIFrame*,nsIContent* ,nsIAtom*,nsIStyleContext**) [nsCSSFrameConstructor.cpp:2829] nsCSSFrameConstructor::ConstructFrame(nsIPresContext*,nsIContent*,nsIFrame*,nsAb soluteItems&,nsFrameItems&,nsAbsoluteItems&,nsAbsoluteItems&) [nsCSSFrameConstructor.cpp:2852] nsCSSFrameConstructor::ContentAppended(nsIPresContext*,nsIContent*,int) [nsCSSFrameConstructor.cpp:3133] StyleSetImpl::ContentAppended(nsIPresContext*,nsIContent*,int) [nsStyleSet.cpp:738] PresShell::ContentAppended(nsIDocument*,nsIContent*,int) [nsPresShell.cpp:1592] nsDocument::ContentAppended(nsIContent*,int) [nsDocument.cpp:1233] nsHTMLDocument::ContentAppended(nsIContent*,int) [nsHTMLDocument.cpp:683] HTMLContentSink::WillInterrupt() [nsHTMLContentSink.cpp:1500] CNavDTD::WillInterruptParse() [CNavDTD.cpp:2721] nsParser::ResumeParse(nsIDTD*) [nsParser.cpp:757] nsParser::OnDataAvailable(nsIURL*,nsIInputStream*,unsigned int) [nsParser.cpp:963] nsDocumentBindInfo::OnDataAvailable(nsIURL*,nsIInputStream*,unsigned int) [nsDocLoader.cpp:1783] stub_put_block(_NET_StreamClass*,const char*,int) [nsStubContext.cpp:647] net_MemCacheWrite [mkmemcac.c:664] net_pull_http_data [mkhttp.c:3097] net_ProcessHTTP [mkhttp.c:3489] * Block of 80 bytes (3 times); last block at 0xc143b8
SelectorMatches() in nsCSSStyleSheet.cpp looks like it should be releasing it (but isn't?).
Assignee: peterl → gagan
Component: Style System → Networking Library
I believe the actual leak is in nsHttpURLFactory.cpp: NS_IMETHODIMP nsHttpURLFactory::CreateURL(nsIURL* *aResult, const nsString& aSpec, const nsIURL* aContextURL, nsISupports* aContainer, nsIURLGroup* aGroup) { nsHttpUrlImpl* url = new nsHttpUrlImpl(aContainer, aGroup); if (url == NULL) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(url); nsresult err = url->ParseURL(aSpec, aContextURL); if (err != NS_OK) return err; If the ParseURL call returns an error then the newly created URL will leak.
I will patch this and see if that fixes the problem and report back to save Gagan the time. Gagan: I'll have an answer for you by tomorrow morning PST hopefully.
QA Contact: 4110 → 3819
That seemed to do it for me in a cursory look.
Status: NEW → ASSIGNED
Bah!
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fix checked in. Thanks peterl and bruce@cybersight.
Whiteboard: waiting for reporter's OK
bruce, can you verify that the leak is gone? Thanks.
This just landed now. Sorry I forgot to mention that I fixed it on the branch N2. But checkout the latest and try.
I'll do this either late tonight or early in the morning tomorrow. (along with other N2 stuff!)
Status: RESOLVED → VERIFIED
Looks good.
Changing all Networking Library/Browser bugs to Networking-Core component for Browser. Occasionally, Bugzilla will burp and cause Verified bugs to reopen when I do this in a bulk change. If this happens, I will fix. ;-)
Bulk move of all Networking-Core (to be deleted component) bugs to new Networking component.
You need to log in before you can comment on or make changes to this bug.