Skip to content

Commit

Permalink
Merge pull request ocaml#12953 from dustanddreams/yacc_shave
Browse files Browse the repository at this point in the history
ocamlyacc: plug memory leaks
  • Loading branch information
dra27 authored Feb 1, 2024
2 parents 74e30ec + 77b105e commit 6ce040f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion yacc/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ static void process_open_curly_bracket(FILE *f) {
unterminated_string(s_lineno, s_line, s_cptr);
}
}
FREE(s_line);
FREE(buf);
return;
}
Expand Down Expand Up @@ -741,8 +742,10 @@ get_tag(void)

for (i = 0; i < ntags; ++i)
{
if (strcmp(cache, tag_table[i]) == 0)
if (strcmp(cache, tag_table[i]) == 0) {
FREE(t_line);
return (tag_table[i]);
}
}

if (ntags >= tagmax)
Expand Down

0 comments on commit 6ce040f

Please sign in to comment.