add preload check to options initialization

This commit is contained in:
daan 2019-12-01 00:03:35 -08:00
parent a407f35c64
commit 36d168a2d9

View File

@ -367,6 +367,10 @@ static bool mi_getenv(const char* name, char* result, size_t result_size) {
}
#endif
static void mi_option_init(mi_option_desc_t* desc) {
#ifndef _WIN32
// cannot call getenv() when still initializing the C runtime.
if (_mi_preloading()) return;
#endif
// Read option value from the environment
char buf[64+1];
mi_strlcpy(buf, "mimalloc_", sizeof(buf));