Working on the new lazy transform for jsonb I found another memory leak in
PLyObject_ToJsonbValue(): palloc() for output boolean JsonbValue is unnecessary,
'out' variable is already initialized.
Fix is attached.
On 15.06.2018 14:42, Alexander Korotkov wrote:
> Hi!
>
> On Fri, Jun 15, 2018 at 2:11 PM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:
>
> I found a memory leak in PLySequence_ToJsonbValue():
> PyObject returned from PySequence_GetItem() is not released.
>
> A bug can be easily reproduced using function roudtrip() from regression test:
> SELECT roundtrip('[1,2,3]'::jsonb) FROM generate_series(1, 1000000);
>
> Similar code in PLyMapping_ToJsonbValue() seems to be correct because
> PyList_GetItem() and PyTuple_GetItem() return a borrowed reference.
>
> Patch with fix is attached.
> I'm going to check and commit this if everything is OK.
>
> ------
> Alexander Korotkov
> Postgres Professional: http://www.postgrespro.com
> The Russian Postgres Company
--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company