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

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Дата
Msg-id ZlPIYLl7Vvd-QusT@paquier.xyz
обсуждение исходный текст
Ответ на Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Список pgsql-hackers
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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Speed up JSON escape processing with SIMD plus other optimisations
Следующее
От: shveta malik
Дата:
Сообщение: Re: Conflict Detection and Resolution