From 53844067b1bea36cbbb0c6210e60d6f2bcea8e98 Mon Sep 17 00:00:00 2001 From: Al Date: Sun, 5 Apr 2015 22:02:31 -0400 Subject: [PATCH] [fix] better allocation sizes for tokenized strings --- src/tokens.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tokens.c b/src/tokens.c index d79e7e7c..e3543fdd 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -22,7 +22,7 @@ void tokenized_string_add_token(tokenized_string_t *self, const char *src, size_ tokenized_string_t *tokenized_string_from_tokens(char *src, token_array *tokens) { tokenized_string_t *self = malloc(sizeof(tokenized_string_t)); - self->str = cstring_array_new_size(strlen(src)); + self->str = cstring_array_new_size(strlen(src) + tokens->n); self->tokens = tokens; token_t token;