fix(esp_https_server): SSL context leak when HTTPS server fails to start

This commit is contained in:
David Slay
2026-02-13 22:49:46 -06:00
committed by Ashish Sharma
parent 5c8e8945e3
commit 66c328d398
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -432,8 +432,9 @@ esp_err_t httpd_ssl_start(httpd_handle_t *pHandle, struct httpd_ssl_config *conf
ret = httpd_start(&handle, &config->httpd);
if (ret != ESP_OK) {
free(ssl_ctx);
ssl_ctx = NULL;
if (ssl_ctx) {
free_secure_context(ssl_ctx);
}
return ret;
}