Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Fix cfml/HTML scanner tag-name leak; drop the LSan suppression

Martin Vogel945e55d4d96c
diff --git a/internal/cbm/vendored/common/scanner.h b/internal/cbm/vendored/common/scanner.h
index a04ea12f1..829b4d40d 100644
--- a/internal/cbm/vendored/common/scanner.h
+++ b/internal/cbm/vendored/common/scanner.h
@@ -1138,18 +1138,22 @@ static bool scan_start_tag_name(Scanner *scanner, TSLexer *lexer, bool is_cf_con
return true;
case CF_SET:
lexer->result_symbol = CF_SET_START_TAG_NAME;
+ tag_free(&tag); /* not pushed to the stack — free its owned tag_name */
return true;
case CF_RETURN:
lexer->result_symbol = CF_RETURN_START_TAG_NAME;
+ tag_free(&tag); /* not pushed to the stack — free its owned tag_name */
return true;
case CF_IF:
lexer->result_symbol = CF_IF_START_TAG_NAME;
break;
case CF_ELSEIF:
lexer->result_symbol = CF_ELSEIF_TAG_NAME;
+ tag_free(&tag); /* not pushed to the stack — free its owned tag_name */
return true;
case CF_ELSE:
lexer->result_symbol = CF_ELSE_TAG_NAME;
+ tag_free(&tag); /* not pushed to the stack — free its owned tag_name */
return true;
case CF_XML:
lexer->result_symbol = CF_XML_START_TAG_NAME;
diff --git a/tests/test_main.c b/tests/test_main.c
index 2c8644b48..51c0b03cc 100644
--- a/tests/test_main.c
+++ b/tests/test_main.c
@@ -85,18 +85,6 @@ extern void suite_stack_overflow(void);
* caches at thread teardown (pass_parallel.c). */
extern void cbm_kind_in_set_free_cache(void);
-/* LeakSanitizer (Linux x64) suppressions. scan_tag_name is in the vendored,
- * shared HTML-family tree-sitter scanner (common/scanner.h, used by cfml/html/…);
- * it leaks a small bounded tag-name buffer in an edge path of scan_start_tag_name's
- * tag-type switch. That is regenerated 3rd-party code whose tag_for_name
- * copy-vs-move ownership cannot be verified without HTML-family parse testing, so
- * the bounded leak is suppressed rather than risking a blind double-free patch.
- * (The larger sql scanner leak WAS fixed properly in sql/scanner.c.) */
-const char *__lsan_default_suppressions(void);
-const char *__lsan_default_suppressions(void) {
- return "leak:scan_tag_name\n";
-}
-
int main(void) {
printf("\n codebase-memory-mcp C test suite\n");