mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-13 12:19:24 +00:00
global: clean up crt only after freeing tls data
The thread local storage is used to hold some global state that is dynamically allocated and should be freed upon exit. On Windows, we clean up the C run-time right after execution of registered shutdown callbacks and before cleaning up the TLS. When we clean up the CRT, we also cause it to analyze for memory leaks. As we did not free the TLS yet this will lead to false positives. Fix the issue by first freeing the TLS and cleaning up the CRT only afterwards.
This commit is contained in:
parent
6e0d473bee
commit
d1fb89dd2f
10
src/global.c
10
src/global.c
@ -85,11 +85,6 @@ static void shutdown_common(void)
|
|||||||
|
|
||||||
git__free(git__user_agent);
|
git__free(git__user_agent);
|
||||||
git__free(git__ssl_ciphers);
|
git__free(git__ssl_ciphers);
|
||||||
|
|
||||||
#if defined(GIT_MSVC_CRTDBG)
|
|
||||||
git_win32__crtdbg_stacktrace_cleanup();
|
|
||||||
git_win32__stack_cleanup();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,6 +176,11 @@ int git_libgit2_shutdown(void)
|
|||||||
|
|
||||||
TlsFree(_tls_index);
|
TlsFree(_tls_index);
|
||||||
git_mutex_free(&git__mwindow_mutex);
|
git_mutex_free(&git__mwindow_mutex);
|
||||||
|
|
||||||
|
#if defined(GIT_MSVC_CRTDBG)
|
||||||
|
git_win32__crtdbg_stacktrace_cleanup();
|
||||||
|
git_win32__stack_cleanup();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exit the lock */
|
/* Exit the lock */
|
||||||
|
Loading…
Reference in New Issue
Block a user