Merge pull request #3275 from git-up/http_fix http: fixed leak when asking for credentials again
diff --git a/src/transports/http.c b/src/transports/http.c
index 2110f32..dd44264 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -337,6 +337,10 @@ static int on_headers_complete(http_parser *parser)
no_callback = 1;
} else {
if (allowed_auth_types) {
+ if (t->cred) {
+ t->cred->free(t->cred);
+ t->cred = NULL;
+ }
error = t->owner->cred_acquire_cb(&t->cred,
t->owner->url,