summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-09 23:06:01 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-09 23:06:01 +0000
commit019041b6b97e9811d5a1996b519096afa370f16f (patch)
tree5bf0403089011b49ae855901dc9df69e1ec2584b /net
parent494499a46994ac498b8370e875fc1e28988f88c7 (diff)
downloadchromium_src-019041b6b97e9811d5a1996b519096afa370f16f.zip
chromium_src-019041b6b97e9811d5a1996b519096afa370f16f.tar.gz
chromium_src-019041b6b97e9811d5a1996b519096afa370f16f.tar.bz2
Remove unnecessary null pointer tests to avoid a false Coverity
FORWARD_NULL defect. In the for loop, at most one buffer in the |buffers| array is of type SECBUFFER_DATA and at most one is of type SECBUFFER_EXTRA. The null pointer test for decrypted_ptr_ is not necessary because when we encounter the only buffer of type SECBUFFER_DATA, decrypted_ptr_ must be NULL (the initial value). I added a DCHECK to assert that. Similarly the null pointer test for received_ptr_ is not necessary. R=mattm BUG=22286 CID=5331 TEST=one Review URL: http://codereview.chromium.org/371014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/socket/ssl_client_socket_win.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc
index 7212095..3d1841b 100644
--- a/net/socket/ssl_client_socket_win.cc
+++ b/net/socket/ssl_client_socket_win.cc
@@ -1091,13 +1091,19 @@ int SSLClientSocketWin::DoPayloadDecrypt() {
received_ptr_ = NULL;
bytes_received_ = 0;
for (int i = 1; i < 4; i++) {
- if (!decrypted_ptr_ && buffers[i].BufferType == SECBUFFER_DATA) {
- decrypted_ptr_ = static_cast<char*>(buffers[i].pvBuffer);
- bytes_decrypted_ = buffers[i].cbBuffer;
- }
- if (!received_ptr_ && buffers[i].BufferType == SECBUFFER_EXTRA) {
- received_ptr_ = static_cast<char*>(buffers[i].pvBuffer);
- bytes_received_ = buffers[i].cbBuffer;
+ switch (buffers[i].BufferType) {
+ case SECBUFFER_DATA:
+ DCHECK(!decrypted_ptr_ && bytes_decrypted_ == 0);
+ decrypted_ptr_ = static_cast<char*>(buffers[i].pvBuffer);
+ bytes_decrypted_ = buffers[i].cbBuffer;
+ break;
+ case SECBUFFER_EXTRA:
+ DCHECK(!received_ptr_ && bytes_received_ == 0);
+ received_ptr_ = static_cast<char*>(buffers[i].pvBuffer);
+ bytes_received_ = buffers[i].cbBuffer;
+ break;
+ default:
+ break;
}
}