mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-15 13:56:34 +08:00
Fix start_tag leak in the vendored SQL scanner deserialize
tree_sitter_sql_external_scanner_deserialize set state->start_tag = NULL and re-malloc'd it without freeing the previous allocation. tree-sitter calls deserialize repeatedly during a parse, leaking the prior start_tag each time (LeakSanitizer, Linux x64). Free it first — safe since create() NULL-inits it and destroy() frees+NULLs it.
This commit is contained in:
+1
@@ -179,6 +179,7 @@ unsigned tree_sitter_sql_external_scanner_serialize(void *payload, char *buffer)
|
||||
|
||||
void tree_sitter_sql_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) {
|
||||
LexerState *state = (LexerState *)payload;
|
||||
free(state->start_tag); /* deserialize is called repeatedly; free the prior tag first */
|
||||
state->start_tag = NULL;
|
||||
// A length of 1 can't exists.
|
||||
if (length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user