From ef3073aaf9f4e3aca88f0c1b991b431fd55f665d Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 18 Apr 2018 22:12:46 +0200 Subject: [PATCH] LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT: 'lfree' mus be volatile --- src/core/mem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/mem.c b/src/core/mem.c index 3f361e79..315fb3c5 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -384,8 +384,6 @@ LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED + (2U * SIZEOF_STRUCT_MEM static u8_t *ram; /** the last entry, always unused! */ static struct mem *ram_end; -/** pointer to the lowest free block, this is used for faster search */ -static struct mem *lfree; /** concurrent access protection */ #if !NO_SYS @@ -403,6 +401,7 @@ static volatile u8_t mem_free_count; #define LWIP_MEM_ALLOC_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_alloc) #define LWIP_MEM_ALLOC_PROTECT() SYS_ARCH_PROTECT(lev_alloc) #define LWIP_MEM_ALLOC_UNPROTECT() SYS_ARCH_UNPROTECT(lev_alloc) +#define LWIP_MEM_LFREE_VOLATILE volatile #else /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ @@ -414,9 +413,13 @@ static volatile u8_t mem_free_count; #define LWIP_MEM_ALLOC_DECL_PROTECT() #define LWIP_MEM_ALLOC_PROTECT() #define LWIP_MEM_ALLOC_UNPROTECT() +#define LWIP_MEM_LFREE_VOLATILE #endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ +/** pointer to the lowest free block, this is used for faster search */ +static struct mem * LWIP_MEM_LFREE_VOLATILE lfree; + #if MEM_SANITY_CHECK static void mem_sanity(void); #define MEM_SANITY() mem_sanity()