Commit 3a8b69d13da66a0555231c84e71df010129b5afb

Leo Yang 2015-02-26T11:47:07

Fix leak of TLS error message in shutdown (ptherad version)

diff --git a/src/global.c b/src/global.c
index fcbcbb1..ee4c929 100644
--- a/src/global.c
+++ b/src/global.c
@@ -263,9 +263,7 @@ int init_error = 0;
 
 static void cb__free_status(void *st)
 {
-	git_global_st *state = (git_global_st *) st;
-	git__free(state->error_t.message);
-
+	giterr_clear();
 	git__free(st);
 }
 
@@ -308,6 +306,8 @@ int git_libgit2_shutdown(void)
 	/* Shut down any subsystems that have global state */
 	git__shutdown();
 
+	giterr_clear();
+
 	ptr = pthread_getspecific(_tls_key);
 	pthread_setspecific(_tls_key, NULL);
 	git__free(ptr);