Re: [PATCH][BUG FIX] Unsafe access pointers.

Поиск
Список
Период
Сортировка
Искать
От
Daniel Gustafsson
Тема
Re: [PATCH][BUG FIX] Unsafe access pointers.
Дата
Msg-id
FCE1BDEF-8B51-4AC2-9FE7-B885B3CFA321@yesql.se
Ответ на
Список
Дерево обсуждения
[PATCH][BUG FIX] Unsafe access pointers. Ranier Vilela <ranier_gyn@hotmail.com>
Re: [PATCH][BUG FIX] Unsafe access pointers. Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [PATCH][BUG FIX] Unsafe access pointers. Daniel Gustafsson <daniel@yesql.se>
RE: [PATCH][BUG FIX] Unsafe access pointers. Ranier Vilela <ranier_gyn@hotmail.com>
> On 15 Nov 2019, at 12:25, Ranier Vilela  wrote:

> It's probably not happening, but it can happen, I think.

I don't think it can, given how elog() works.

> -	if (!HeapTupleIsValid(classtup))
> +	if (!HeapTupleIsValid(classtup)) {
> 		elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
> +        return false;

elog or ereport with a severity of ERROR or higher will never return.

> -	if (!HeapTupleIsValid(familytup))
> +	if (!HeapTupleIsValid(familytup)) {
> 		elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
> +	    ReleaseSysCache(classtup);
> +        return false;
> +    }

Not only will elog(ERROR ..) not return to run this, the errorhandling
machinery will automatically release resources and clean up.

cheers ./daniel


В списке pgsql-hackers по дате отправления
От: Ranier Vilela
Дата:
От: Fabien COELHO
Дата:
FAQ