Merge branch 'bugfix/memory_leak_in_http_digest_authentication' into 'master'

fix(esp_http_client): fixed memory leak issue while preparing HTTP digest authentication

Closes IDFGH-14071

See merge request espressif/esp-idf!36066
This commit is contained in:
Mahavir Jain
2025-01-13 15:59:03 +08:00

View File

@@ -636,6 +636,8 @@ static esp_err_t esp_http_client_prepare_digest_auth(esp_http_client_handle_t cl
char *auth_response = NULL;
esp_err_t ret = ESP_FAIL;
// Freeing the allocated memory for auth_data->uri and setting it to NULL to prevent potential memory leaks
free(client->auth_data->uri);
client->auth_data->uri = NULL;
ESP_GOTO_ON_FALSE_DEBUG(http_utils_assign_string(&client->auth_data->uri, client->connection_info.path, -1), ESP_ERR_NO_MEM, error, TAG, "failed to assign string");