You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Board: ESP32 Dev Module
Core Installation version: 1.0.3
IDE name: Platform.io
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
WiFiClientSecure does not free memory after a failed connection.
Update: In the ssl_client.cpp, in start_ssl_client function.
if (rootCABuff != NULL) {
log_v("Loading CA cert");
mbedtls_x509_crt_init(&ssl_client->ca_cert);
mbedtls_ssl_conf_authmode(&ssl_client->ssl_conf, MBEDTLS_SSL_VERIFY_REQUIRED);
ret = mbedtls_x509_crt_parse(&ssl_client->ca_cert, (const unsigned char *)rootCABuff, strlen(rootCABuff) + 1);
mbedtls_ssl_conf_ca_chain(&ssl_client->ssl_conf, &ssl_client->ca_cert, NULL);
//mbedtls_ssl_conf_verify(&ssl_client->ssl_ctx, my_verify, NULL );
if (ret < 0) {
return handle_error(ret);
}
}
You can see that after mbedtls_x509_crt_init(&ssl_client->ca_cert);, if (ret < 0) has no mbedtls_x509_crt_free(&ssl_client->ca_cert); to free memory.
So the free memory in RAM decreasing continuously.
The same thing (I guess) may occur with the
ret = mbedtls_x509_crt_parse(&ssl_client->client_cert, (const unsigned char *)cli_cert, strlen(cli_cert) + 1);
if (ret < 0) {
return handle_error(ret);
}
and the
ret = mbedtls_pk_parse_key(&ssl_client->client_key, (const unsigned char *)cli_key, strlen(cli_key) + 1, NULL, 0);
if (ret != 0) {
return handle_error(ret);
}
So please update the code. My project is stuck here. I need your help.
Thank you so much.
Sketch:
void loop() {
// put your main code here, to run repeatedly:
Serial.println(esp_get_free_heap_size());
WiFiClientSecure client;
client.setCACert(test_root_ca);
client.setCertificate(client_crt);
client.setPrivateKey(client_key);
Serial.println(client.connect("test.mosquitto.org", 8884, 500));
client.stop();
}
I met problem while I was working with the WiFiClientSecure.
I tried to found the source of the problem, and I found it in the sll_client.cpp.
Please check my contribution.
I've open this problem in espressif#4335 but received no response.
I met problem while I was working with the WiFiClientSecure.
I tried to found the source of the problem, and I found it in the sll_client.cpp.
Please check my contribution.
I've open this problem in #4335 but received no response.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.3
IDE name: Platform.io
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
WiFiClientSecure does not free memory after a failed connection.
Update: In the ssl_client.cpp, in start_ssl_client function.
You can see that after
mbedtls_x509_crt_init(&ssl_client->ca_cert);
,if (ret < 0)
has nombedtls_x509_crt_free(&ssl_client->ca_cert);
to free memory.So the free memory in RAM decreasing continuously.
The same thing (I guess) may occur with the
and the
So please update the code. My project is stuck here. I need your help.
Thank you so much.
Sketch:
Serial Monitor:
WiFi connected.
IP address:
192.168.1.37
213744
0
206964
0
201252
0
195012
0
189440
0
183204
0
175860
0
171924
0
165688
0
160332
0
155072
0
149676
0
142304
0
138484
0
133096
0
125940
0
121700
0
115892
0
110076
0
104268
0
98340
0
93076
0
87148
0
81472
0
75868
0
69728
0
64468
0
58868
0
59020
0
59020
0
59020
0
53064
0
53220
0
53220
0
53220
0
53220
0
53220
0
53220
0
53220
0
53428
0
53428
0
53428
0
53428
0
47680
0
41748
0
36280
0
30352
0
30836
0
30836
The text was updated successfully, but these errors were encountered: