Skip to content

Commit

Permalink
Merge pull request #116 from Brainrotlang/fix/memory-leak-slorp-string
Browse files Browse the repository at this point in the history
fix: memory leak on slorping a string
  • Loading branch information
araujo88 authored Feb 1, 2025
2 parents a269661 + 9d57d08 commit 2f2c498
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,8 @@ void execute_slorp_call(ArgumentList *args)
{
char val[var->array_length];
slorp_string(val, sizeof(val));
var->value.array_data = safe_strdup(val);
strncpy(var->value.array_data, val, var->array_length - 1);
((char *)var->value.array_data)[var->array_length - 1] = '\0';
return;
}
char val = 0;
Expand Down

0 comments on commit 2f2c498

Please sign in to comment.