about summary refs log tree commit diff
path: root/src/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'src/malloc')
-rw-r--r--src/malloc/lite_malloc.c2
-rw-r--r--src/malloc/malloc.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/malloc/lite_malloc.c b/src/malloc/lite_malloc.c
index 673966a1..7643fc2c 100644
--- a/src/malloc/lite_malloc.c
+++ b/src/malloc/lite_malloc.c
@@ -12,7 +12,7 @@ void *__simple_malloc(size_t n)
 {
 	static uintptr_t cur, brk;
 	uintptr_t base, new;
-	static int lock[2];
+	static volatile int lock[2];
 	size_t align=1;
 
 	if (!n) n++;
diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c
index 7932a975..70c7b3f3 100644
--- a/src/malloc/malloc.c
+++ b/src/malloc/malloc.c
@@ -25,7 +25,7 @@ struct chunk {
 };
 
 struct bin {
-	int lock[2];
+	volatile int lock[2];
 	struct chunk *head;
 	struct chunk *tail;
 };
@@ -33,10 +33,10 @@ struct bin {
 static struct {
 	uintptr_t brk;
 	size_t *heap;
-	uint64_t binmap;
+	volatile uint64_t binmap;
 	struct bin bins[64];
-	int brk_lock[2];
-	int free_lock[2];
+	volatile int brk_lock[2];
+	volatile int free_lock[2];
 	unsigned mmap_step;
 } mal;
 
@@ -205,7 +205,7 @@ fail:
 
 static int init_malloc(size_t n)
 {
-	static int init, waiters;
+	static volatile int init, waiters;
 	int state;
 	struct chunk *c;