Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(969)

Unified Diff: third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp

Issue 2702403007: Fix BlobBytesConsumer leak (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
index 46c1d67272916034c739ad0467ac12513022a9a2..66849a66312da4e35d1819c55f0e67ab641ecbbc 100644
--- a/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
@@ -37,7 +37,10 @@ BlobBytesConsumer::BlobBytesConsumer(ExecutionContext* executionContext,
PassRefPtr<BlobDataHandle> blobDataHandle)
: BlobBytesConsumer(executionContext, std::move(blobDataHandle), nullptr) {}
-BlobBytesConsumer::~BlobBytesConsumer() {}
+BlobBytesConsumer::~BlobBytesConsumer() {
+ if (!m_blobURL.isEmpty())
+ BlobRegistry::revokePublicBlobURL(m_blobURL);
+}
BytesConsumer::Result BlobBytesConsumer::beginRead(const char** buffer,
size_t* available) {
@@ -52,7 +55,8 @@ BytesConsumer::Result BlobBytesConsumer::beginRead(const char** buffer,
}
if (isClean()) {
- KURL m_blobURL =
+ DCHECK(m_blobURL.isEmpty());
+ m_blobURL =
BlobURL::createPublicURL(getExecutionContext()->getSecurityOrigin());
if (m_blobURL.isEmpty()) {
error();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698