File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
libraries/ESP8266WiFi/src Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ extern "C"
5353uint8_t * default_private_key = 0 ;
5454uint32_t default_private_key_len = 0 ;
5555static bool default_private_key_dynamic = false ;
56- //
56+ static int s_pk_refcnt = 0 ;
5757uint8_t * default_certificate = 0 ;
5858uint32_t default_certificate_len = 0 ;
5959static bool default_certificate_dynamic = false ;
@@ -81,9 +81,6 @@ class SSLContext {
8181 if (_ssl_ctx_refcnt == 0 ) {
8282 ssl_ctx_free (_ssl_ctx);
8383 }
84-
85- clear_private_key ();
86- clear_certificate ();
8784 }
8885
8986 void ref () {
@@ -186,12 +183,17 @@ int SSLContext::_ssl_ctx_refcnt = 0;
186183
187184
188185WiFiClientSecure::WiFiClientSecure () {
186+ ++s_pk_refcnt;
189187}
190188
191189WiFiClientSecure::~WiFiClientSecure () {
192190 if (_ssl) {
193191 _ssl->unref ();
194192 }
193+ if (--s_pk_refcnt == 0 ) {
194+ clear_private_key ();
195+ clear_certificate ();
196+ }
195197}
196198
197199WiFiClientSecure::WiFiClientSecure (const WiFiClientSecure& other)
You can’t perform that action at this time.
0 commit comments