Re: pgsql: PL/Python: Fix potential NULL pointer dereference

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: pgsql: PL/Python: Fix potential NULL pointer dereference
Дата
Msg-id ff4fa2ea-5085-40dd-aabb-110c6255dade@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: pgsql: PL/Python: Fix potential NULL pointer dereference  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: PL/Python: Fix potential NULL pointer dereference  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
On 12/5/17 14:45, Tom Lane wrote:
> On the whole it seems like it might be better to dodge this whole business
> of changing "result" inside the TRY.  You could do that if you did
> something like
> 
>                 result->rows = PyList_New(rows);
> -               if (!result->rows)
> -               {
> -                   Py_DECREF(result);
> -                   result = NULL;
> -               }
> -               else
> +               if (result->rows)
>                 {
>                     PLy_input_setup_tuple(&ininfo, tuptable->tupdesc,
> 
> and then add after the PG_END_TRY
> 
>                 if (!result->rows)
>                 {
>                     Py_DECREF(result);
>                     result = NULL;
>                 }

Yeah, that looks much better.  Next try attached.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Remove bug from OPTIMIZER_DEBUG code for partition-wise join.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: PL/Python: Fix potential NULL pointer dereference