Re: Fix calloc check if oom (PQcancelCreate) - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Fix calloc check if oom (PQcancelCreate)
Date
Msg-id CB73DAA5-6C1C-46D1-AD58-A213175B6938@yesql.se
Whole thread Raw
In response to Fix calloc check if oom (PQcancelCreate)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Fix calloc check if oom (PQcancelCreate)
List pgsql-hackers
> On 27 May 2024, at 14:25, Ranier Vilela <ranier.vf@gmail.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




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: relfilenode statistics
Next
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Add more SQL/JSON constructor functions