diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-29 22:33:52 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-29 22:33:52 +0530 |
| commit | 22b62228d0b8fe081ec6df95cf331b3d290127ab (patch) | |
| tree | e7f14f22742945241118dbd9ad2fbdc0c5ccb8d8 /src/lexer.c | |
| parent | 5b6b95cd4f875d7a619aa69bde8d1d2f93bbc254 (diff) | |
engine,lexer: fix memory leaks
Diffstat (limited to 'src/lexer.c')
| -rw-r--r-- | src/lexer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lexer.c b/src/lexer.c index 9e38960..829942a 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -188,8 +188,8 @@ lexer_handle_eachdo(directive_t *directive, directive->type = EACHDO; eachdo_operands_t *operands = malloc(sizeof(eachdo_operands_t)); - operands->key = trim(strndup(buffer + n + strlen("eachdo"), - match->length - n - strlen("eachdo") - 2)); + operands->key = strndup(buffer + n + strlen("eachdo"), + match->length - n - strlen("eachdo") - 2); buffer += match->length; key_match_t *new_match; @@ -210,7 +210,6 @@ lexer_handle_eachdo(directive_t *directive, printf("Cannot find directive: %.*s\n", new_match->length, buffer + new_match->offset); - free(new_directive); free(new_match); free(directive); return; @@ -219,6 +218,9 @@ lexer_handle_eachdo(directive_t *directive, if (new_directive->type == ENDEACHDO) { free(new_directive); break; + } else { + /* TODO: delete_directive */ + free(new_directive->operands); } free(new_directive); |
