summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Arroz <750683+arroz@users.noreply.github.com>2021-09-02 18:59:19 -0700
committerMiguel Arroz <750683+arroz@users.noreply.github.com>2021-09-02 18:59:19 -0700
commit27f50a66124054518d5febe984bccad02ee0846b (patch)
tree57de85537333cc610708b08dcfb130e2523e5a9d
parent4fd32be01c79a5c003bb47674ac1d76d948518b7 (diff)
downloadlibgit2-27f50a66124054518d5febe984bccad02ee0846b.tar.gz
#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.
-rw-r--r--src/threadstate.c3
1 files changed, 2 insertions, 1 deletions
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;
}