From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: PL/Python: Fix potential NULL pointer dereference |
Date: | 2017-12-12 17:10:21 |
Message-ID: | ff4fa2ea-5085-40dd-aabb-110c6255dade@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
v2-0001-PL-Python-Fix-potential-NULL-pointer-dereference.patch | text/plain | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-12-12 21:42:59 | Re: pgsql: PL/Python: Fix potential NULL pointer dereference |
Previous Message | Robert Haas | 2017-12-12 15:56:28 | pgsql: Remove bug from OPTIMIZER_DEBUG code for partition-wise join. |