From a7d0a9267ead2b50998d5de436ff370eadf0d0a7 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 2 Mar 2012 23:44:55 -0500 Subject: [PATCH] Bug 732319. Fix leaks on CORS failures in imagelib. r=joe --- image/src/imgLoader.cpp | 7 +++++++ image/test/crashtests/732319-1.html | 2 ++ image/test/crashtests/crashtests.list | 1 + 3 files changed, 10 insertions(+) create mode 100644 image/test/crashtests/732319-1.html diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 9a3596664df5..36c8e6a19191 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -1718,12 +1718,19 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, // request. nsCOMPtr listener = pl; if (corsmode != imgIRequest::CORS_NONE) { + PR_LOG(gImgLog, PR_LOG_DEBUG, + ("[this=%p] imgLoader::LoadImage -- Setting up a CORS load", + this)); bool withCredentials = corsmode == imgIRequest::CORS_USE_CREDENTIALS; nsCOMPtr corsproxy = new nsCORSListenerProxy(pl, aLoadingPrincipal, newChannel, withCredentials, &rv); if (NS_FAILED(rv)) { + PR_LOG(gImgLog, PR_LOG_DEBUG, + ("[this=%p] imgLoader::LoadImage -- nsCORSListenerProxy " + "creation failed: 0x%x\n", this, rv)); + request->CancelAndAbort(rv); return NS_ERROR_FAILURE; } diff --git a/image/test/crashtests/732319-1.html b/image/test/crashtests/732319-1.html new file mode 100644 index 000000000000..b9d9c6de87b3 --- /dev/null +++ b/image/test/crashtests/732319-1.html @@ -0,0 +1,2 @@ + + diff --git a/image/test/crashtests/crashtests.list b/image/test/crashtests/crashtests.list index f31a2d9e6e1a..a462023fa839 100644 --- a/image/test/crashtests/crashtests.list +++ b/image/test/crashtests/crashtests.list @@ -25,3 +25,4 @@ HTTP load delayedframe.sjs load 681190.html load 694165-1.xhtml +load 732319-1.html