diff --git a/components/esp_http_client/lib/http_auth.c b/components/esp_http_client/lib/http_auth.c index ef30dc4043c8..0a1e46526a12 100644 --- a/components/esp_http_client/lib/http_auth.c +++ b/components/esp_http_client/lib/http_auth.c @@ -51,6 +51,7 @@ static int md5_printf(char *md, const char *fmt, ...) va_start(ap, fmt); len = vasprintf((char **)&buf, fmt, ap); if (buf == NULL) { + va_end(ap); return ESP_FAIL; } diff --git a/components/esp_http_client/lib/http_header.c b/components/esp_http_client/lib/http_header.c index 0e41786ec76a..265bbbe7aaad 100644 --- a/components/esp_http_client/lib/http_header.c +++ b/components/esp_http_client/lib/http_header.c @@ -161,8 +161,8 @@ int http_header_set_format(http_header_handle_t header, const char *key, const c char *buf = NULL; va_start(argptr, format); len = vasprintf(&buf, format, argptr); - HTTP_MEM_CHECK(TAG, buf, return 0); va_end(argptr); + HTTP_MEM_CHECK(TAG, buf, return 0); if (buf == NULL) { return 0; }