Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Date: 2024-05-27 18:27:05
Message-ID: CAExHW5vOPOy_CkkT8smYfCZMemTccvifEa=FQzdZ_QggEp=Mqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks a lot Michael.

On Sun, May 26, 2024 at 4:40 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Fri, May 24, 2024 at 09:05:35AM -0300, Ranier Vilela wrote:
> > The function *get_attname* palloc the result name (pstrdup).
> > Isn't it necessary to free the memory here (pfree)?
>
> This is going to be freed with the current memory context, and all the
> callers of getIdentitySequence() are in query execution paths, so I
> don't see much the point. A second thing was a missing check on the
> attnum returned by get_attnum() with InvalidAttrNumber. I'd be
> tempted to introduce a missing_ok to this routine after looking at the
> callers in all the tree, as some of them want to fail still would not
> expect it, so that would reduce a bit the elog churn. That's a story
> for a different day, though.
> --
> Michael
>

--
Best Wishes,
Ashutosh Bapat

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2024-05-27 21:17:25 Re: apply_scanjoin_target_to_paths and partitionwise join
Previous Message Michael Paquier 2024-05-27 18:20:52 Re: Comments on Custom RMGRs