Skip site navigation (1) Skip section navigation (2)

pl/python: fix ref leak on elog

From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: pl/python: fix ref leak on elog
Date: 2005-12-29 16:54:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Attached is a simple patch that fixes a minor problem in PL/Python: in 
PLy_spi_execute_plan(), we invoke the input function for a Postgres data 
type. If that function elog's (which is quite possible), PL/Python leaks 
references to two temporary Python objects. The fix seems easy, albeit a 
bit ugly: the reference count on one of the temporary objects can be 
decremented before calling the function. A pointer that points into the 
second object is passed to the input function itself, so we have to 
PG_CATCH() the elog and decrement the refcount then.

Since the problem might actually occur in practice and the fix seems to 
have little chance of inducing a regression, I'm thinking of applying 
this to both HEAD and back branches. Barring any objections I'll do that 
later today or early tomorrow.


Attachment: plpython_ref_leak-3.patch
Description: text/x-patch (3.0 KB)


pgsql-patches by date

Next:From: Bruce MomjianDate: 2005-12-29 17:15:23
Subject: Re: to_char and i18n
Previous:From: Qingqing ZhouDate: 2005-12-29 07:05:35
Subject: Re: Fix spinlock usage in UnpinBuffer()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group