From 0fb7d5381ef29b837ea602e853d0fdc057da0e6c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Jun 2020 22:08:49 +1000 Subject: MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE 'const' arrays couldn't use this macro with GNUC. --- intern/guardedalloc/MEM_guardedalloc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index d5b109ee59f..1af513e9264 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -204,7 +204,8 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT; do { \ typeof(&(v)) _v = &(v); \ if (*_v) { \ - MEM_freeN(*_v); \ + /* Cast so we can free constant arrays. */ \ + MEM_freeN((void *)*_v); \ *_v = NULL; \ } \ } while (0) -- cgit v1.2.3