From 437d90c40852bbf49da42047d8697e47e825d4dc Mon Sep 17 00:00:00 2001 From: Harshit Malpani Date: Thu, 7 Apr 2022 10:40:35 +0530 Subject: [PATCH] esp_http_client: Fix redirect by resetting auth_header before parsing --- components/esp_http_client/esp_http_client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/esp_http_client/esp_http_client.c b/components/esp_http_client/esp_http_client.c index b66fa0e166..7df3e22615 100644 --- a/components/esp_http_client/esp_http_client.c +++ b/components/esp_http_client/esp_http_client.c @@ -522,6 +522,10 @@ static esp_err_t esp_http_client_prepare(esp_http_client_handle_t client) free(client->location); client->location = NULL; } + if (client->auth_header != NULL) { + free(client->auth_header); + client->auth_header = NULL; + } http_parser_init(client->parser, HTTP_RESPONSE); if (client->connection_info.username) { char *auth_response = NULL;