@@ -1681,7 +1681,9 @@ static idx_e check_duplicates(thread_db* tdbb,
1681
1681
index_desc* insertion_idx = insertion->iib_descriptor ;
1682
1682
record_param rpb;
1683
1683
rpb.rpb_relation = insertion->iib_relation ;
1684
- rpb.rpb_record = NULL ;
1684
+
1685
+ AutoTempRecord gc_record (VIO_gc_record (tdbb, rpb.rpb_relation ));
1686
+ rpb.rpb_record = gc_record;
1685
1687
1686
1688
jrd_rel* const relation_1 = insertion->iib_relation ;
1687
1689
RecordBitmap::Accessor accessor (insertion->iib_duplicates );
@@ -1754,7 +1756,8 @@ static idx_e check_duplicates(thread_db* tdbb,
1754
1756
}
1755
1757
} while (accessor.getNext ());
1756
1758
1757
- delete rpb.rpb_record ;
1759
+ if (rpb.rpb_record != gc_record)
1760
+ delete rpb.rpb_record ;
1758
1761
1759
1762
return result;
1760
1763
}
@@ -1952,12 +1955,13 @@ static idx_e check_partner_index(thread_db* tdbb,
1952
1955
if ((idx->idx_flags & idx_descending) != (partner_idx.idx_flags & idx_descending))
1953
1956
BTR_complement_key (key);
1954
1957
1955
- RecordBitmap* bitmap = NULL ;
1958
+ RecordBitmap bm (*tdbb->getDefaultPool ());
1959
+ RecordBitmap* bitmap = &bm;
1956
1960
BTR_evaluate (tdbb, &retrieval, &bitmap, NULL );
1957
1961
1958
1962
// if there is a bitmap, it means duplicates were found
1959
1963
1960
- if (bitmap)
1964
+ if (bitmap-> getFirst () )
1961
1965
{
1962
1966
index_insertion insertion;
1963
1967
insertion.iib_descriptor = &partner_idx;
@@ -1972,7 +1976,6 @@ static idx_e check_partner_index(thread_db* tdbb,
1972
1976
result = result ? idx_e_foreign_references_present : idx_e_ok;
1973
1977
if (idx->idx_flags & idx_foreign)
1974
1978
result = result ? idx_e_ok : idx_e_foreign_target_doesnt_exist;
1975
- delete bitmap;
1976
1979
}
1977
1980
else if (idx->idx_flags & idx_foreign)
1978
1981
result = idx_e_foreign_target_doesnt_exist;
0 commit comments