Fix null pointer dereference in hnsw_reconnect_nodes() (#15911)

This commit is contained in:
Syh-Xiong authored and GitHub committed 2026-10-10 16:54:25 +08:00
1 parent 3c7e951c3d
commit 558ef8fafb
1 file changed
+1 -1
+1 -1
View File
@@ -1708,13 +1708,13 @@ void hnsw_reconnect_nodes(HNSW *index, hnswNode **nodes, int count, uint32_t lay
// Step 5: Pair nodes greedily based on scores.
int *used = hmalloc(count*sizeof(int));
memset(used,0,count*sizeof(int));
if (!used) {
hfree(distances);
hfree(row_avgs);
hfree(scores);
return;
}
memset(used,0,count*sizeof(int));
/* Scan the matrix looking each time for the potential
* link with the best score. */