diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-24 15:08:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-24 15:13:27 +0300 |
commit | 074929d1c5f5b0e9a4da3c3058cc9f3038fb2910 (patch) | |
tree | c22e4c3b2d06c6c347b3ef2c05c48b9a35dad0d4 /intern/guardedalloc | |
parent | 9b3dfbe6513106c71faa50d09fbe27a071b3194f (diff) |
MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE
'const' arrays couldn't use this macro with GNUC.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 602297576c8..bbba69edf1d 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -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) |