diff --git a/src/pq_flash_index.cpp b/src/pq_flash_index.cpp index 265f266bd..5cff00efa 100644 --- a/src/pq_flash_index.cpp +++ b/src/pq_flash_index.cpp @@ -675,7 +675,6 @@ template bool PQFlashIndex::point_has_any_label(uint32_t point_id, const std::vector &label_ids) { uint32_t start_vec = _pts_to_label_offsets[point_id]; - uint32_t num_lbls = _pts_to_label_counts[start_vec]; bool ret_val = false; for (auto &cur_lbl : label_ids) { @@ -706,9 +705,10 @@ void PQFlashIndex::parse_label_file(std::basic_istream &infile, uint32_t num_pts_in_label_file; uint32_t num_total_labels; get_label_file_metadata(buffer, num_pts_in_label_file, num_total_labels); + _num_total_labels = num_total_labels; _pts_to_label_offsets = new uint32_t[num_pts_in_label_file]; - _pts_to_label_counts = new uint32_t[num_pts_in_label_file]; + _pts_to_label_counts = new uint32_t[num_total_labels]; _pts_to_labels = new LabelT[num_total_labels]; uint32_t labels_seen_so_far = 0;