diff --git a/hnsw.c b/hnsw.c index 75130722f..4b4fafa56 100644 --- a/hnsw.c +++ b/hnsw.c @@ -1200,7 +1200,8 @@ void hnsw_reconnect_nodes(HNSW *index, hnswNode **nodes, int count, uint32_t lay } // Step 5: Pair nodes greedily based on scores. - int *used = calloc(count, sizeof(int)); + int *used = hmalloc(count*sizeof(int)); + memset(used,0,count*sizeof(int)); if (!used) { hfree(distances); hfree(row_avgs);