diff --git a/src/stralloc.c b/src/stralloc.c
index ddfe9635d0967c7aca47c352cce2c04fa7ec936f..350475b6855cd84995c15e0658caf65513ec76b6 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -3144,7 +3144,7 @@ PMOD_EXPORT struct pike_string *finish_string_builder(struct string_builder *s)
 {
   ptrdiff_t len = s->s->len;
   if (len != s->malloced) {
-    s->s->len = s->malloced;
+    s->s->len = s->malloced;	/* Restore the allocated length. */
     s->s = realloc_unlinked_string(s->s, len);
   }
   if(s->known_shift == s->s->size_shift)