Fix memleaks and error handling in jsonb_plpython

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix memleaks and error handling in jsonb_plpython
Date: 2019-03-01 02:24:39
Message-ID: 28053a7d-10d8-fc23-b05c-b4749c873f63@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Unfortunately, contrib/jsonb_plpython still contain a lot of problems in error
handling that can lead to memory leaks:
- not all Python function calls are checked for the success
- not in all places PG exceptions are caught to release Python references
But it seems that this errors can happen only in OOM case.

Attached patch with the fix. Back-patch for PG11 is needed.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-Fix-memleaks-and-error-handling-in-jsonb_plpython-v01.patch text/x-patch 5.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2019-03-01 02:27:04 Re: NOT IN subquery optimization
Previous Message Amit Kapila 2019-03-01 02:19:46 Re: pgsql: Avoid creation of the free space map for small heap relations, t