Skip to content

Commit

Permalink
Merge pull request #173 from milianw/fix-to_next_sibling-rc
Browse files Browse the repository at this point in the history
Decrement refcount before calling free in to_next_sibling
  • Loading branch information
Veykril authored Oct 31, 2024
2 parents 4bc8ba0 + 3294973 commit c4cb18a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ impl SyntaxNode {
Some(SyntaxNode { ptr })
})
.or_else(|| {
data.dec_rc();
unsafe { free(ptr) };
None
})
Expand Down Expand Up @@ -1234,6 +1235,7 @@ impl SyntaxElement {
}
})
.or_else(|| {
data.dec_rc();
unsafe { free(ptr) };
None
})
Expand Down

0 comments on commit c4cb18a

Please sign in to comment.