From a0e39346e2f1d85921c1cb2ff613a1d61e19f169 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 15 Feb 2006 00:36:58 +0000 Subject: [PATCH] =?UTF-8?q?2006-02-14=20=20Ludovic=20Court=C3=A8s=20=20=20=20=20=20=20=20=20=20=20*=20strings.c?= =?UTF-8?q?=20(scm=5Fi=5Ftake=5Fstringbufn):=20Register=20LEN+1=20bytes=20?= =?UTF-8?q?instead=20of=20=09LEN.=20=20Without=20this,=20too=20much=20coll?= =?UTF-8?q?ectable=20memory=20gets=20unregistered,=20=09which=20results=20?= =?UTF-8?q?in=20an=20underflow=20of=20SCM=5FMALLOCATED=20in=20=09`decrease?= =?UTF-8?q?=5Fmtrigger()'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libguile/strings.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libguile/strings.c b/libguile/strings.c index 137ad5d09..1f3094dc6 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -122,12 +122,12 @@ make_stringbuf (size_t len) } } -/* Return a new stringbuf whose underlying storage consists of the LEN octets - pointed to by STR. */ +/* Return a new stringbuf whose underlying storage consists of the LEN+1 + octets pointed to by STR (the last octet is zero). */ SCM_C_INLINE SCM scm_i_take_stringbufn (char *str, size_t len) { - scm_gc_register_collectable_memory (str, len, "stringbuf"); + scm_gc_register_collectable_memory (str, len + 1, "stringbuf"); return scm_double_cell (STRINGBUF_TAG, (scm_t_bits) str, (scm_t_bits) len, (scm_t_bits) 0);