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(pipeline): preserve allocation policy in resolver cleanup

Martin Vogel57e04c63593e
diff --git a/src/pipeline/pass_lsp_cross.c b/src/pipeline/pass_lsp_cross.c
index c72a2a5d0..1bd08dc70 100644
--- a/src/pipeline/pass_lsp_cross.c
+++ b/src/pipeline/pass_lsp_cross.c
@@ -2361,8 +2361,7 @@ CBMLSPDef *cbm_pxc_filter_defs_for_file(const CBMModuleDefIndex *idx, CBMLSPDef
pxc_mark_module_defs(idx, selected, all_defs, caller_lang, own_module, &total);
for (int i = 0; i < imp_count; i++) {
if (!pxc_mark_import_defs(idx, selected, all_defs, caller_lang, imp_qns[i], &total)) {
- free(selected);
- return NULL; /* out_success remains false: dispatcher uses all_defs */
+ goto failed; /* out_success remains false: dispatcher uses all_defs */
}
}
if (pxc_is_jvm_lang(caller_lang) && idx->namespace_ht) {
@@ -2379,8 +2378,7 @@ CBMLSPDef *cbm_pxc_filter_defs_for_file(const CBMModuleDefIndex *idx, CBMLSPDef
CBMLSPDef *out = (CBMLSPDef *)malloc((size_t)total * sizeof(CBMLSPDef));
if (!out) {
- cbm_free(CBM_MEM_CLASS_EXTRACT, selected);
- return NULL;
+ goto failed;
}
int n = 0;
@@ -2393,4 +2391,7 @@ CBMLSPDef *cbm_pxc_filter_defs_for_file(const CBMModuleDefIndex *idx, CBMLSPDef
*out_success = true;
cbm_free(CBM_MEM_CLASS_EXTRACT, selected);
return out;
+failed:
+ cbm_free(CBM_MEM_CLASS_EXTRACT, selected);
+ return NULL;
}