diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c index ae7a913..d7475ab 100644 --- a/src/backend/nodes/tidbitmap.c +++ b/src/backend/nodes/tidbitmap.c @@ -1522,7 +1522,7 @@ static inline void * pagetable_allocate(pagetable_hash *pagetable, Size size) { TIDBitmap *tbm = (TIDBitmap *) pagetable->private_data; - PTEntryArray *ptbase; + PTEntryArray *ptbase = NULL; if (tbm->dsa == NULL) return MemoryContextAllocExtended(pagetable->ctx, size, @@ -1533,9 +1533,13 @@ pagetable_allocate(pagetable_hash *pagetable, Size size) * new memory so that pagetable_free can free the old entry. */ tbm->dsapagetableold = tbm->dsapagetable; - tbm->dsapagetable = dsa_allocate0(tbm->dsa, sizeof(PTEntryArray) + size); - + tbm->dsapagetable = dsa_allocate_extended(tbm->dsa, + sizeof(PTEntryArray) + size, + DSA_ALLOC_HUGE | DSA_ALLOC_ZERO); ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable); + if (ptbase == NULL) + return NULL; + return ptbase->ptentry; }