Commit 1630981e6bec6145970952f9ab5c5742ba1449cd

Pierre-Olivier Latour 2015-06-30T09:03:23

http: fixed leak when asking for credentials again t->cred might have been allocated the previous time and needs to be freed before asking caller for credentials again.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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,