Merge pull request #6029 from arroz/fix_6028 #6028: Check if `threadstate->error_t.message` is not `git_buf__initbuf` before freeing.
diff --git a/src/threadstate.c b/src/threadstate.c
index 6031e82..e2c0897 100644
--- a/src/threadstate.c
+++ b/src/threadstate.c
@@ -36,7 +36,8 @@ static void threadstate_dispose(git_threadstate *threadstate)
if (!threadstate)
return;
- git__free(threadstate->error_t.message);
+ if (threadstate->error_t.message != git_buf__initbuf)
+ git__free(threadstate->error_t.message);
threadstate->error_t.message = NULL;
}