From 94a316578aa883f23698d270cabf151da2f69e50 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 28 Sep 2002 08:03:38 +0000 Subject: [PATCH] Bug fix [SVN r15536] --- historic/jam/src/newstr.c | 2 +- jam_src/newstr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/historic/jam/src/newstr.c b/historic/jam/src/newstr.c index 32562d4a9..58668fcb6 100644 --- a/historic/jam/src/newstr.c +++ b/historic/jam/src/newstr.c @@ -74,7 +74,7 @@ static char* allocate(size_t n) nalloc = STRING_BLOCK; /* allocate a new block and link into the chain */ - new_block = malloc( offsetof( strblock, data[nalloc] ) ); + new_block = malloc( offsetof( strblock, data[0] ) + nalloc * sizeof(new_block->data[0]) ); if ( new_block == 0 ) return 0; new_block->next = strblock_chain; diff --git a/jam_src/newstr.c b/jam_src/newstr.c index 32562d4a9..58668fcb6 100644 --- a/jam_src/newstr.c +++ b/jam_src/newstr.c @@ -74,7 +74,7 @@ static char* allocate(size_t n) nalloc = STRING_BLOCK; /* allocate a new block and link into the chain */ - new_block = malloc( offsetof( strblock, data[nalloc] ) ); + new_block = malloc( offsetof( strblock, data[0] ) + nalloc * sizeof(new_block->data[0]) ); if ( new_block == 0 ) return 0; new_block->next = strblock_chain;