summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/gc-malloc.c9
1 files changed, 8 insertions, 1 deletions
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;
}