From 1c8857bce13d0fb7a7ee8f12c154a2392afe00a2 Mon Sep 17 00:00:00 2001 From: "rsleevi@chromium.org" Date: Sat, 26 Jun 2010 18:44:05 +0000 Subject: Make X509Certificate::CreateFromHandle() copy the OSCertHandle, rather than assume ownership R=wtc BUG=47463 TEST=none Review URL: http://codereview.chromium.org/2867026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50938 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/ssl_client_socket_win.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'net/socket/ssl_client_socket_win.cc') diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc index 7fd1f7c..a0da5f4 100644 --- a/net/socket/ssl_client_socket_win.cc +++ b/net/socket/ssl_client_socket_win.cc @@ -415,8 +415,9 @@ void SSLClientSocketWin::GetSSLCertRequestInfo( } scoped_refptr cert = X509Certificate::CreateFromHandle( cert_context2, X509Certificate::SOURCE_LONE_CERT_IMPORT, - net::X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles()); cert_request_info->client_certs.push_back(cert); + CertFreeCertificateContext(cert_context2); } FreeContextBuffer(issuer_list.aIssuers); @@ -1307,15 +1308,15 @@ int SSLClientSocketWin::DidCompleteHandshake() { server_cert_handle)) { // We already verified the server certificate. Either it is good or the // user has accepted the certificate error. - CertFreeCertificateContext(server_cert_handle); DidCompleteRenegotiation(); } else { server_cert_ = X509Certificate::CreateFromHandle( server_cert_handle, X509Certificate::SOURCE_FROM_NETWORK, - net::X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles()); next_state_ = STATE_VERIFY_CERT; } + CertFreeCertificateContext(server_cert_handle); return OK; } -- cgit v1.1