Skip to content

Commit ee3baed

Browse files
authored
Merge pull request libgit2#4724 from libgit2/cmn/allocator-init-order
alloc: don't overwrite allocator during init if set
2 parents 2510268 + 19007b1 commit ee3baed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/alloc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ git_allocator git__allocator;
1717

1818
int git_allocator_global_init(void)
1919
{
20+
/*
21+
* We don't want to overwrite any allocator which has been set before
22+
* the init function is called.
23+
*/
24+
if (git__allocator.gmalloc != NULL)
25+
return 0;
26+
2027
#if defined(GIT_MSVC_CRTDBG)
2128
return git_win32_crtdbg_init_allocator(&git__allocator);
2229
#else

0 commit comments

Comments
 (0)