diff options
Diffstat (limited to 'src/gmalloc.c')
| -rw-r--r-- | src/gmalloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c index a17d39c1eeb..97ab76561f9 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -40,6 +40,8 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>. | |||
| 40 | # include "lisp.h" | 40 | # include "lisp.h" |
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #include "ptr-bounds.h" | ||
| 44 | |||
| 43 | #ifdef HAVE_MALLOC_H | 45 | #ifdef HAVE_MALLOC_H |
| 44 | # if GNUC_PREREQ (4, 2, 0) | 46 | # if GNUC_PREREQ (4, 2, 0) |
| 45 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 47 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| @@ -558,7 +560,7 @@ malloc_initialize_1 (void) | |||
| 558 | _heapinfo[0].free.size = 0; | 560 | _heapinfo[0].free.size = 0; |
| 559 | _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; | 561 | _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; |
| 560 | _heapindex = 0; | 562 | _heapindex = 0; |
| 561 | _heapbase = (char *) _heapinfo; | 563 | _heapbase = (char *) ptr_bounds_init (_heapinfo); |
| 562 | _heaplimit = BLOCK (_heapbase + heapsize * sizeof (malloc_info)); | 564 | _heaplimit = BLOCK (_heapbase + heapsize * sizeof (malloc_info)); |
| 563 | 565 | ||
| 564 | register_heapinfo (); | 566 | register_heapinfo (); |
| @@ -997,6 +999,7 @@ _free_internal_nolock (void *ptr) | |||
| 997 | 999 | ||
| 998 | if (ptr == NULL) | 1000 | if (ptr == NULL) |
| 999 | return; | 1001 | return; |
| 1002 | ptr = ptr_bounds_init (ptr); | ||
| 1000 | 1003 | ||
| 1001 | PROTECT_MALLOC_STATE (0); | 1004 | PROTECT_MALLOC_STATE (0); |
| 1002 | 1005 | ||
| @@ -1308,6 +1311,7 @@ _realloc_internal_nolock (void *ptr, size_t size) | |||
| 1308 | else if (ptr == NULL) | 1311 | else if (ptr == NULL) |
| 1309 | return _malloc_internal_nolock (size); | 1312 | return _malloc_internal_nolock (size); |
| 1310 | 1313 | ||
| 1314 | ptr = ptr_bounds_init (ptr); | ||
| 1311 | block = BLOCK (ptr); | 1315 | block = BLOCK (ptr); |
| 1312 | 1316 | ||
| 1313 | PROTECT_MALLOC_STATE (0); | 1317 | PROTECT_MALLOC_STATE (0); |