Re: [PATCH] dynahash: add memory allocation failure check

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: m(dot)korotkov(at)postgrespro(dot)ru
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] dynahash: add memory allocation failure check
Date: 2025-04-23 13:39:54
Message-ID: CAJ7c6TMO1nQGo_gD-0+Ry7=k-tjc1Oar_EaZOW-aq3S7H1b8vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Maksim,

> I found a case of potential NULL pointer dereference.
> In src/backend/utils/hash/dynahash.c in function HTAB *hash_create() the
> result of the DynaHashAlloc() is used unsafely.
> The function DynaHashAlloc() calls MemoryContextAllocExtended() with
> MCXT_ALLOC_NO_OOM and can return a NULL pointer.
> Added the pointer check for avoiding a potential problem.

Thanks for the patch. It looks correct to me.

I didn't check if it needs to be back-ported and if it does - to how
many branches.

--
Best regards,
Aleksander Alekseev

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-04-23 13:50:54 Re: extension_control_path and "directory"
Previous Message m.korotkov 2025-04-23 13:09:57 Re: [PATCH] dynahash: add memory allocation failure check