Historically, `free(3)`-style functions have been NULL-safe, to make resource handling functions more robust. This doesn't seem to be the case with tree-sitter's `ts_tree_delete` and `ts_parser_delete` C functions, which immediately dereference the passed pointer. This leads to complexity in client libraries that have to ensure that trees and parsers are cleaned up correctly. This patch adds NULL checks to `parse_delete` and `tree_delete`. They should have negligable performance impacts, since null checks are fast. I didn't change the internal _delete functions, as arguably those being NULL-unsafe is a feature, not a bug. |
||
|---|---|---|
| .. | ||
| binding_rust | ||
| binding_web | ||
| include/tree_sitter | ||
| src | ||
| utf8proc@d81308faba | ||
| Cargo.toml | ||
| README.md | ||
Subdirectories
src- C source code for the Tree-sitter libraryinclude- C headers for the Tree-sitter libraryutf8proc- A submodule forutf8proc, Tree-sitter's one library dependency.binding_rust- Rust bindings to the Tree-sitter librarybinding_web- JavaScript bindings to the Tree-sitter library, using WebAssembly