Skip to content

Commit 27f50a6

Browse files
committed
libgit2#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 libgit2#6028.
1 parent 4fd32be commit 27f50a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/threadstate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ static void threadstate_dispose(git_threadstate *threadstate)
3636
if (!threadstate)
3737
return;
3838

39-
git__free(threadstate->error_t.message);
39+
if (threadstate->error_t.message != git_buf__initbuf)
40+
git__free(threadstate->error_t.message);
4041
threadstate->error_t.message = NULL;
4142
}
4243

0 commit comments

Comments
 (0)