Skip to content

Commit 66f2413

Browse files
committed
test(contract): free node fields in calls_edge_targets helper
cbm_store_find_node_by_id heap-allocates the node's string fields; the DeusData#871 helper left them unfreed, tripping LSan on the Linux legs. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 8a1b5f6 commit 66f2413

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎tests/test_lang_contract.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,11 +1217,12 @@ static int calls_edge_targets(cbm_store_t *store, const char *project, const cha
12171217
if (cbm_store_find_node_by_id(store, edges[i].target_id, &tgt) != CBM_STORE_OK)
12181218
continue;
12191219
const char *qn = tgt.qualified_name;
1220-
if (!qn || !tgt.label || strcmp(tgt.label, label) != 0)
1221-
continue;
1222-
size_t ql = strlen(qn);
1223-
if (ql >= sl && strcmp(qn + ql - sl, qn_suffix) == 0)
1224-
found = 1;
1220+
if (qn && tgt.label && strcmp(tgt.label, label) == 0) {
1221+
size_t ql = strlen(qn);
1222+
if (ql >= sl && strcmp(qn + ql - sl, qn_suffix) == 0)
1223+
found = 1;
1224+
}
1225+
cbm_node_free_fields(&tgt);
12251226
}
12261227
cbm_store_free_edges(edges, n);
12271228
return found;

0 commit comments

Comments
 (0)