Re: Fix calloc check if oom (PQcancelCreate)

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix calloc check if oom (PQcancelCreate)
Date: 2024-05-27 13:22:57
Message-ID: CB73DAA5-6C1C-46D1-AD58-A213175B6938@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 27 May 2024, at 14:25, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:

> I think that commit 61461a3, left some oversight.
> The function *PQcancelCreate* fails in check,
> return of *calloc* function.
>
> Trivial fix is attached.

Agreed, this looks like a copy/paste from the calloc calls a few lines up.

> But, IMO, I think that has more problems.
> If any allocation fails, all allocations must be cleared.
> Or is the current behavior acceptable?

Since this is frontend library code I think we should free all the allocations
in case of OOM.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-05-27 13:26:58 Re: pgsql: Add more SQL/JSON constructor functions
Previous Message Robert Haas 2024-05-27 13:10:13 Re: relfilenode statistics