@@ -577,9 +577,9 @@ rumBuildCallback(Relation index, HeapTuple htup, Datum *values,
577
577
while ((list = rumGetBAEntry (& buildstate -> accum ,
578
578
& attnum ,& key ,& category ,& nlist ))!= NULL )
579
579
{
580
- ItemPointerData * iptrs = (ItemPointerData * )palloc (sizeof (ItemPointerData )* nlist );
581
- Datum * addInfo = (Datum * )palloc (sizeof (Datum )* nlist );
582
- bool * addInfoIsNull = (bool * )palloc (sizeof (bool )* nlist );
580
+ ItemPointerData * iptrs = (ItemPointerData * )palloc (sizeof (* iptrs )* nlist );
581
+ Datum * addInfo = (Datum * )palloc (sizeof (* addInfo )* nlist );
582
+ bool * addInfoIsNull = (bool * )palloc (sizeof (* addInfoIsNull )* nlist );
583
583
int i ;
584
584
585
585
for (i = 0 ;i < nlist ;i ++ )
@@ -594,6 +594,10 @@ rumBuildCallback(Relation index, HeapTuple htup, Datum *values,
594
594
CHECK_FOR_INTERRUPTS ();
595
595
rumEntryInsert (& buildstate -> rumstate ,attnum ,key ,category ,
596
596
iptrs ,addInfo ,addInfoIsNull ,nlist ,& buildstate -> buildStats );
597
+
598
+ pfree (addInfoIsNull );
599
+ pfree (addInfo );
600
+ pfree (iptrs );
597
601
}
598
602
599
603
MemoryContextReset (buildstate -> tmpCtx );