Fix missing prev update in hnsw_cursor_free causing unlink failure (#14050)

This PR fixes a bug in the `hnsw_cursor_free` function where the prev
pointer was never updated during cursor list traversal. As a result, if
the cursor being freed was not the head of the list, it would not be
correctly unlinked, potentially causing memory leaks or corruption of
the cursor list.

Note that since `hnsw_cursor_free()` is never used for now, this PR does
not actually fix any bug.
This commit is contained in:
Vitah Lin 2025-08-28 21:17:55 +08:00 committed by GitHub
parent e2b8f8ff6d
commit 38d16a82eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -2489,6 +2489,7 @@ void hnsw_cursor_free(hnswCursor *cursor) {
hfree(cursor);
break;
}
prev = x;
x = x->next;
}
pthread_rwlock_unlock(&cursor->index->global_lock);