mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 14:14:33 +02:00
Merge branch 'bugfix/fix_coverity_issue_in_esp_http_client' into 'master'
esp_http_client: free `auth_str` before going out of scope See merge request espressif/esp-idf!22014
This commit is contained in:
@@ -126,12 +126,13 @@ char *http_auth_digest(const char *username, const char *password, esp_http_auth
|
|||||||
}
|
}
|
||||||
if (auth_data->opaque) {
|
if (auth_data->opaque) {
|
||||||
rc = asprintf(&temp_auth_str, "%s, opaque=\"%s\"", auth_str, auth_data->opaque);
|
rc = asprintf(&temp_auth_str, "%s, opaque=\"%s\"", auth_str, auth_data->opaque);
|
||||||
|
// Free the previous memory allocated for `auth_str`
|
||||||
|
free(auth_str);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
ESP_LOGE(TAG, "asprintf() returned: %d", rc);
|
ESP_LOGE(TAG, "asprintf() returned: %d", rc);
|
||||||
ret = ESP_FAIL;
|
ret = ESP_FAIL;
|
||||||
goto _digest_exit;
|
goto _digest_exit;
|
||||||
}
|
}
|
||||||
free(auth_str);
|
|
||||||
auth_str = temp_auth_str;
|
auth_str = temp_auth_str;
|
||||||
}
|
}
|
||||||
_digest_exit:
|
_digest_exit:
|
||||||
|
Reference in New Issue
Block a user