Commit d31bc5cb authored by Timur Pocheptsov's avatar Timur Pocheptsov
Browse files

QNetworkReplyImplPrivate - potential nullptr dereference


Found by Coverity, CID 11351. If we check 'if (backend)' at one line,
not clear why we do 'if (bakcend->canResume())' two lines above without any test.
Also, 'delete backend' is noop if backend is nullptr, so ...
even this 'if (backend)' is ... not needed.

Change-Id: I7a46ce04baeb9251debb7b246954911df58880ca
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: default avatarTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Showing with 2 additions and 6 deletions
......@@ -1100,21 +1100,17 @@ bool QNetworkReplyImplPrivate::migrateBackend()
return true;
// Backend does not support resuming download.
if (!backend->canResume())
if (backend && !backend->canResume())
return false;
state = QNetworkReplyPrivate::Reconnecting;
if (backend) {
delete backend;
backend = 0;
}
cookedHeaders.clear();
rawHeaders.clear();
preMigrationDownloaded = bytesDownloaded;
delete backend;
backend = manager->d_func()->findBackend(operation, request);
if (backend) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment