Fix all valgrind errors

This commit is contained in:
2026-04-26 22:13:39 +02:00
parent dbc69eddc8
commit 129036b539
3 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ v0/bin/test: $(V0_SRC_OBJ_NO_MAIN) $(V0_TEST_OBJ)
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
test:: v0/bin/test test:: v0/bin/test
valgrind --leak-check=full --error-exitcode=1 v0/bin/test valgrind --quiet --leak-check=full --error-exitcode=1 v0/bin/test
generate_golden:: v0/bin/test generate_golden:: v0/bin/test
GENERATE_GOLDEN=1 v0/bin/test GENERATE_GOLDEN=1 v0/bin/test
+3
View File
@@ -22,6 +22,9 @@ Module* parser_parse(TokenStream* ts) {
fprintf(stderr, "Out of memory\n"); fprintf(stderr, "Out of memory\n");
exit(1); exit(1);
} }
module->name = NULL;
module->imports = NULL;
module->import_count = 0;
module->name = (char*)malloc(t.text.length + 1); module->name = (char*)malloc(t.text.length + 1);
if (module->name == NULL) { if (module->name == NULL) {
+1
View File
@@ -196,6 +196,7 @@ int main(int argc, char** argv) {
} }
if (s_testSource) free(s_testSource); if (s_testSource) free(s_testSource);
log_clear();
if (failedCount > 0) { if (failedCount > 0) {
printf("\nFailed tests:\n"); printf("\nFailed tests:\n");