diff options
author | Carlos MartÃn Nieto <carlosmn@github.com> | 2018-07-15 19:28:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-15 19:28:22 +0200 |
commit | ee3baed1788f3e94ab6cfd550ee35667af764f45 (patch) | |
tree | 0881210ee61eb83c8b143ee1f7d992b7ad10e0eb | |
parent | 2510268a269cd79e5cfa68ce8f56e540131f3b6d (diff) | |
parent | 19007b19b70504a3964f5d8320d0ef39c01ce6b0 (diff) | |
download | libgit2-ee3baed1788f3e94ab6cfd550ee35667af764f45.tar.gz |
Merge pull request #4724 from libgit2/cmn/allocator-init-order
alloc: don't overwrite allocator during init if set
-rw-r--r-- | src/alloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 35fdd00c4..d4e6f1ebd 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -17,6 +17,13 @@ git_allocator git__allocator; int git_allocator_global_init(void) { + /* + * We don't want to overwrite any allocator which has been set before + * the init function is called. + */ + if (git__allocator.gmalloc != NULL) + return 0; + #if defined(GIT_MSVC_CRTDBG) return git_win32_crtdbg_init_allocator(&git__allocator); #else |