Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: runtime/bin/secure_socket.cc

Issue 1383713002: Free copy of hostname in SecureSocket implementation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index af90fabb7c4759cbc8c9f426722feb42ad115a3a..c75d65e1bf14f86bbf0f3931dab43638bb82718a 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -899,11 +899,9 @@ void SSLFilter::Connect(const char* hostname,
X509_V_FLAG_PARTIAL_CHAIN |
X509_V_FLAG_TRUSTED_FIRST);
X509_VERIFY_PARAM_set_hostflags(certificate_checking_parameters, 0);
- X509_VERIFY_PARAM_set1_host(certificate_checking_parameters,
- hostname_, strlen(hostname_));
- // TODO(24225) Check return value of set1_host().
- // TODO(24186) free hostname_ if it is not freed when SSL is destroyed.
- // otherwise, make it a local variable, not a instance field.
+ status = X509_VERIFY_PARAM_set1_host(certificate_checking_parameters,
+ hostname_, strlen(hostname_));
+ CheckStatus(status, "Set hostname for certificate checking", __LINE__);
}
// Make the connection:
if (is_server_) {
@@ -1044,6 +1042,10 @@ void SSLFilter::Destroy() {
BIO_free(socket_side_);
socket_side_ = NULL;
}
+ if (hostname_ != NULL) {
+ free(hostname_);
+ hostname_ = NULL;
+ }
for (int i = 0; i < kNumBuffers; ++i) {
Dart_DeletePersistentHandle(dart_buffer_objects_[i]);
delete[] buffers_[i];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698