summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes <ludovic.courtes@laas.fr>2007-02-18 13:55:40 +0000
committerLudovic Courtès <ludo@gnu.org>2008-09-10 22:34:13 +0200
commitea4f8ea13f1e9b9d25330251f69d6e9a49e107b4 (patch)
treee8461059b535f1ef289b64580d3a461232e09503
parent4a4849dbe0ae1b731b408167f90222e05d1ca2bd (diff)
downloadguile-ea4f8ea13f1e9b9d25330251f69d6e9a49e107b4.tar.gz
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
-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;
}