diff options
author | Miguel Arroz <750683+arroz@users.noreply.github.com> | 2021-09-02 18:59:19 -0700 |
---|---|---|
committer | Miguel Arroz <750683+arroz@users.noreply.github.com> | 2021-09-02 18:59:19 -0700 |
commit | 27f50a66124054518d5febe984bccad02ee0846b (patch) | |
tree | 57de85537333cc610708b08dcfb130e2523e5a9d | |
parent | 4fd32be01c79a5c003bb47674ac1d76d948518b7 (diff) | |
download | libgit2-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.c | 3 |
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; } |