Skip to content

Commit

Permalink
Fix memleak in sml_tree_parse
Browse files Browse the repository at this point in the history
  • Loading branch information
mbehr1 committed Jul 12, 2020
1 parent 85cfa73 commit d73201e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sml/src/sml_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ sml_tree *sml_tree_parse(sml_buffer *buf) {
int elems;
for (elems = sml_buf_get_next_length(buf); elems > 0; elems--) {
c = sml_tree_parse(buf);
if (sml_buf_has_errors(buf))
if (sml_buf_has_errors(buf)) {
if (c)
sml_tree_free(c);
goto error;
}
if (c) {
sml_tree_add_tree(tree, c);
}
Expand Down

0 comments on commit d73201e

Please sign in to comment.