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: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
bb10
Timur Pocheptsov 2016-04-19 09:33:27 +02:00
parent cc1a28d07e
commit d31bc5cbf9
1 changed files with 2 additions and 6 deletions

View File

@ -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) {