From 27f50a66124054518d5febe984bccad02ee0846b Mon Sep 17 00:00:00 2001 From: Miguel Arroz <750683+arroz@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:59:19 -0700 Subject: #6028: Check if `threadstate->error_t.message` is not `git_buf__initbuf` before freeing. This follows the same principle as `buffer.c` where the same check is done before freeing the buffer. It fixes the crash described in #6028. --- src/threadstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/threadstate.c b/src/threadstate.c index 6031e8280..e2c08975f 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; } -- cgit v1.2.1