From 351bf36ecf4134e9b361a6cd557c5cd3d150eefc Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 29 Dec 2009 19:16:15 +0900 Subject: [PATCH] heaps allocate an extra cell to be safe (re: issue #10) --- gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index 1130c15b..5e2a4d23 100644 --- a/gc.c +++ b/gc.c @@ -171,7 +171,8 @@ sexp sexp_gc (sexp ctx, size_t *sum_freed) { sexp_heap sexp_make_heap (size_t size) { sexp_free_list free, next; - sexp_heap h = (sexp_heap) malloc(sizeof(struct sexp_heap) + size); + sexp_heap h + = (sexp_heap) malloc(sizeof(struct sexp_heap) + size + sexp_heap_align(1)); if (! h) return NULL; h->size = size; h->data = (char*) sexp_heap_align((sexp_uint_t)&(h->data));