File tree 1 file changed +6
-4
lines changed
libraries/ESP8266WiFi/src
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ extern "C"
53
53
uint8_t * default_private_key = 0 ;
54
54
uint32_t default_private_key_len = 0 ;
55
55
static bool default_private_key_dynamic = false ;
56
- //
56
+ static int s_pk_refcnt = 0 ;
57
57
uint8_t * default_certificate = 0 ;
58
58
uint32_t default_certificate_len = 0 ;
59
59
static bool default_certificate_dynamic = false ;
@@ -81,9 +81,6 @@ class SSLContext {
81
81
if (_ssl_ctx_refcnt == 0 ) {
82
82
ssl_ctx_free (_ssl_ctx);
83
83
}
84
-
85
- clear_private_key ();
86
- clear_certificate ();
87
84
}
88
85
89
86
void ref () {
@@ -186,12 +183,17 @@ int SSLContext::_ssl_ctx_refcnt = 0;
186
183
187
184
188
185
WiFiClientSecure::WiFiClientSecure () {
186
+ ++s_pk_refcnt;
189
187
}
190
188
191
189
WiFiClientSecure::~WiFiClientSecure () {
192
190
if (_ssl) {
193
191
_ssl->unref ();
194
192
}
193
+ if (--s_pk_refcnt == 0 ) {
194
+ clear_private_key ();
195
+ clear_certificate ();
196
+ }
195
197
}
196
198
197
199
WiFiClientSecure::WiFiClientSecure (const WiFiClientSecure& other)
You can’t perform that action at this time.
0 commit comments