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
parent 9b3dfbe651
commit 074929d1c5
Notes: blender-bot 2023-02-14 08:39:23 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 2 additions and 1 deletions

View File

@ -187,7 +187,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)