From ea4f8ea13f1e9b9d25330251f69d6e9a49e107b4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 18 Feb 2007 13:55:40 +0000 Subject: [PATCH] scm_gc_malloc: Handle zero-octet allocations. * libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2 --- libguile/gc-malloc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c index 9ef3d9d05..cb11ba049 100644 --- a/libguile/gc-malloc.c +++ b/libguile/gc-malloc.c @@ -209,7 +209,14 @@ scm_gc_malloc (size_t size, const char *what) to write it the program is killed with signal 11. --hwn */ - void *ptr = GC_MALLOC (size); + void *ptr; + + if (size == 0) + /* `GC_MALLOC ()' doesn't handle zero. */ + size = sizeof (void *); + + ptr = GC_MALLOC (size); + return ptr; }