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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: m.korotkov@postgrespro.ru, pgsql-hackers@postgresql.org
Date: 2025-04-24T14:10:22Z
Lists: pgsql-hackers
Andrey Borodin <x4mmm@yandex-team.ru> writes:
> While fixing this maybe use MemoryContextAllocZero() instead of subsequent MemSet()?

I thought about that but intentionally left it as-is, because that
would force zeroing of the space reserved for the hashtable name too.
That's unnecessary, and since it'd often be odd-sized it might result
in a less efficient fill loop.

			regards, tom lane



Commits

  1. Avoid possibly-theoretical OOM crash hazard in hash_create().