summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-04-06 15:32:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-03 19:34:44 +0200
commitffb831d9896dcdd3d469fdbeee407d96d631dbda (patch)
tree3add93677ad04e34ec6f7f4c857aee72080a8691 /src/core
parent2c5b25387c89420cc04decb1298356e452bb5fe5 (diff)
Fix leak if loader error is seen first
For some reason the proxied_loader_receiver can still be bound in this case. Pick-to: 6.3 6.2 5.15 Change-Id: If0bbe181eca5de41e82eebaced412361fe12fb40 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 9c6930563..6b311d7fb 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -175,6 +175,8 @@ private:
bool local_access_ = false;
bool remote_access_ = true;
+ bool loader_error_seen_ = false;
+
// If the |target_loader_| called OnComplete with an error this stores it.
// That way the destructor can send it to OnReceivedError if safe browsing
// error didn't occur.
@@ -391,6 +393,7 @@ void InterceptedRequest::ContinueAfterIntercept()
}
if (!target_loader_ && target_factory_) {
+ loader_error_seen_ = false;
target_factory_->CreateLoaderAndStart(target_loader_.BindNewPipeAndPassReceiver(), request_id_,
options_, request_, proxied_client_receiver_.BindNewPipeAndPassRemote(),
traffic_annotation_);
@@ -496,6 +499,8 @@ void InterceptedRequest::OnURLLoaderError(uint32_t custom_reason, const std::str
// If CallOnComplete was already called, then this object is ready to be deleted.
if (!target_client_)
delete this;
+ else
+ loader_error_seen_ = true;
}
void InterceptedRequest::CallOnComplete(const network::URLLoaderCompletionStatus &status, bool wait_for_loader_error)
@@ -509,7 +514,7 @@ void InterceptedRequest::CallOnComplete(const network::URLLoaderCompletionStatus
if (target_client_)
target_client_->OnComplete(status);
- if (proxied_loader_receiver_.is_bound() && wait_for_loader_error) {
+ if (proxied_loader_receiver_.is_bound() && wait_for_loader_error && !loader_error_seen_) {
// Since the original client is gone no need to continue loading the
// request.
proxied_client_receiver_.reset();