http.c: Fix problem with repeated calls of http_init
authorJulian Phillips <julian@quantumfyre.co.uk>
Sun, 29 Apr 2007 02:46:42 +0000 (03:46 +0100)
committerJunio C Hamano <junkio@cox.net>
Sun, 29 Apr 2007 08:34:59 +0000 (01:34 -0700)
Calling http_init after calling http_cleanup causes a segfault.  This
is due to the pragma_header curl_slist being freed but not being set
to NULL.  The subsequent call to http_init tries to setup the slist
again, but it now points to an invalid memory location.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http.c

diff --git a/http.c b/http.c
index 576740feff9ffa62b65f8cdf0a38f2354872c520..ae27e0c9409b93558e50318f2dd0a4fe758293b5 100644 (file)
--- a/http.c
+++ b/http.c
@@ -300,6 +300,7 @@ void http_cleanup(void)
        curl_global_cleanup();
 
        curl_slist_free_all(pragma_header);
+        pragma_header = NULL;
 }
 
 struct active_request_slot *get_active_slot(void)