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

Unified Diff: runtime/bin/secure_socket_boringssl.h

Issue 2206233003: Fix memory leaks in BoringSSL secure socket implementation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comments Created 4 years, 4 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 | runtime/bin/secure_socket_boringssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket_boringssl.h
diff --git a/runtime/bin/secure_socket_boringssl.h b/runtime/bin/secure_socket_boringssl.h
index d5449a45f5fc7e08040ec2bda68df2710ca059d7..788b2577ee3d32af84778c5dbf8c8b7e485b8233 100644
--- a/runtime/bin/secure_socket_boringssl.h
+++ b/runtime/bin/secure_socket_boringssl.h
@@ -33,8 +33,39 @@ namespace bin {
extern const unsigned char* root_certificates_pem;
extern unsigned int root_certificates_pem_length;
+class SSLContext {
+ public:
+ explicit SSLContext(SSL_CTX* context) :
+ context_(context),
+ alpn_protocol_string_(NULL) {
+ }
+
+ ~SSLContext() {
+ SSL_CTX_free(context_);
+ if (alpn_protocol_string_ != NULL) {
+ free(alpn_protocol_string_);
+ }
+ }
+
+ SSL_CTX* context() const { return context_; }
+
+ uint8_t* alpn_protocol_string() const { return alpn_protocol_string_; }
+ void set_alpn_protocol_string(uint8_t* protocol_string) {
+ if (alpn_protocol_string_ != NULL) {
+ free(alpn_protocol_string_);
+ }
+ alpn_protocol_string_ = protocol_string;
+ }
+
+ private:
+ SSL_CTX* context_;
+ uint8_t* alpn_protocol_string_;
+
+ DISALLOW_COPY_AND_ASSIGN(SSLContext);
+};
+
/*
- * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates
+ * SSLFilter encapsulates the SSL(TLS) code in a filter, that communicates
* with the containing _SecureFilterImpl Dart object through four shared
* ExternalByteArray buffers, for reading and writing plaintext, and
* reading and writing encrypted text. The filter handles handshaking
« no previous file with comments | « no previous file | runtime/bin/secure_socket_boringssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698