Skip to content

Commit d5c8027

Browse files
committed
Fix alloc ast
1 parent 98f7dad commit d5c8027

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/visitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ void remove_trailing_semi(char *str)
144144

145145
int visitor(char *buffer, env_t *env, history_t *history)
146146
{
147-
ast_ctx_t ctx = { 0, .str = buffer, .cap = u_strlen(buffer) + 1,
148-
.ast = malloc(sizeof *ctx.ast * (u_strlen(buffer) + 1)) };
147+
ast_ctx_t ctx = { 0, .str = buffer, .cap = u_strlen(buffer) + 10,
148+
.ast = malloc(sizeof *ctx.ast * (u_strlen(buffer) + 10)) };
149149
ef_t ef = { .buffer = buffer, .env = env,
150150
.history = history, .ctx = &ctx, .pout_fd = STDOUT_FILENO,
151151
.flags = 0, 0 };

0 commit comments

Comments
 (0)