MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE

'const' arrays couldn't use this macro with GNUC.
This commit is contained in:
Campbell Barton 2020-06-24 22:08:49 +10:00 committed by Jeroen Bakker
parent 7369a24f61
commit 0fb7d5381e
Notes: blender-bot 2023-02-14 05:16:25 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 2 additions and 1 deletions

View File

@ -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)