Re: [PATCH] dynahash: add memory allocation failure check - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] dynahash: add memory allocation failure check
Date
Msg-id CAJ7c6TMO1nQGo_gD-0+Ry7=k-tjc1Oar_EaZOW-aq3S7H1b8vw@mail.gmail.com
Whole thread Raw
In response to [PATCH] dynahash: add memory allocation failure check  (m.korotkov@postgrespro.ru)
List 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



pgsql-hackers by date:

Previous
From: m.korotkov@postgrespro.ru
Date:
Subject: Re: [PATCH] dynahash: add memory allocation failure check
Next
From: Christoph Berg
Date:
Subject: Re: extension_control_path and "directory"