Skip to content

Commit 1f6e485

Browse files
committed
---
yaml --- r: 14613 b: refs/heads/try c: 38b2b74 h: refs/heads/master i: 14611: e942fa6 v: v3
1 parent fd61719 commit 1f6e485

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 6b0c4822c10d1e0824043f81fc9e39096cc40172
5+
refs/heads/try: 38b2b74413da1d982df82fbb9552373b7dc52e69
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/memory_region.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,8 @@ memory_region::claim_alloc(void *mem) {
204204

205205
void
206206
memory_region::maybe_poison(void *mem) {
207-
// TODO: We should lock this, in case the compiler doesn't.
208-
static int poison = -1;
209-
if (poison < 0) {
210-
char *env_str = getenv("RUST_POISON_ON_FREE");
211-
poison = env_str != NULL && env_str[0] != '\0';
212-
}
213207

214-
if (!poison)
208+
if (!_srv->env->poison_on_free)
215209
return;
216210

217211
# if RUSTRT_TRACK_ALLOCATIONS >= 1

branches/try/src/rt/rust_env.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define CHECK_CLAIMS "CHECK_CLAIMS"
1414
#define DETAILED_LEAKS "DETAILED_LEAKS"
1515
#define RUST_SEED "RUST_SEED"
16+
#define RUST_POISON_ON_FREE "RUST_POISON_ON_FREE"
1617

1718
#if defined(__WIN32__)
1819
static int
@@ -116,6 +117,7 @@ load_env() {
116117
env->check_claims = getenv(CHECK_CLAIMS) != NULL;
117118
env->detailed_leaks = getenv(DETAILED_LEAKS) != NULL;
118119
env->rust_seed = copyenv(RUST_SEED);
120+
env->poison_on_free = getenv(RUST_POISON_ON_FREE) != NULL;
119121

120122
return env;
121123
}

branches/try/src/rt/rust_env.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ struct rust_env {
66
bool check_claims;
77
bool detailed_leaks;
88
char* rust_seed;
9+
bool poison_on_free;
910
};
1011

1112
rust_env* load_env();

0 commit comments

Comments
 (0)