rt: Move RUST_POISON_ON_FREE into rust_env
This commit is contained in:
parent
6b0c4822c1
commit
38b2b74413
@ -204,14 +204,8 @@ memory_region::claim_alloc(void *mem) {
|
||||
|
||||
void
|
||||
memory_region::maybe_poison(void *mem) {
|
||||
// TODO: We should lock this, in case the compiler doesn't.
|
||||
static int poison = -1;
|
||||
if (poison < 0) {
|
||||
char *env_str = getenv("RUST_POISON_ON_FREE");
|
||||
poison = env_str != NULL && env_str[0] != '\0';
|
||||
}
|
||||
|
||||
if (!poison)
|
||||
if (!_srv->env->poison_on_free)
|
||||
return;
|
||||
|
||||
# if RUSTRT_TRACK_ALLOCATIONS >= 1
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define CHECK_CLAIMS "CHECK_CLAIMS"
|
||||
#define DETAILED_LEAKS "DETAILED_LEAKS"
|
||||
#define RUST_SEED "RUST_SEED"
|
||||
#define RUST_POISON_ON_FREE "RUST_POISON_ON_FREE"
|
||||
|
||||
#if defined(__WIN32__)
|
||||
static int
|
||||
@ -116,6 +117,7 @@ load_env() {
|
||||
env->check_claims = getenv(CHECK_CLAIMS) != NULL;
|
||||
env->detailed_leaks = getenv(DETAILED_LEAKS) != NULL;
|
||||
env->rust_seed = copyenv(RUST_SEED);
|
||||
env->poison_on_free = getenv(RUST_POISON_ON_FREE) != NULL;
|
||||
|
||||
return env;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ struct rust_env {
|
||||
bool check_claims;
|
||||
bool detailed_leaks;
|
||||
char* rust_seed;
|
||||
bool poison_on_free;
|
||||
};
|
||||
|
||||
rust_env* load_env();
|
||||
|
Loading…
x
Reference in New Issue
Block a user