aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonb_util.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-03-26 16:41:32 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-03-26 16:41:32 -0400
commit2d5e0f07de0119045fb889f9c11de0e486ce4ac5 (patch)
treefc476cd1ef0f0a611c2469f7775cd6291f0e4d4c /src/backend/utils/adt/jsonb_util.c
parentc2a6724823c14fd442c5441eb169b2581781fef0 (diff)
downloadpostgresql-2d5e0f07de0119045fb889f9c11de0e486ce4ac5.tar.gz
postgresql-2d5e0f07de0119045fb889f9c11de0e486ce4ac5.zip
Fix refcounting bug in PLy_modify_tuple().
We must increment the refcount on "plntup" as soon as we have the reference, not sometime later. Otherwise, if an error is thrown in between, the Py_XDECREF(plntup) call in the PG_CATCH block removes a refcount we didn't add, allowing the object to be freed even though it's still part of the plpython function's parsetree. This appears to be the cause of crashes seen on buildfarm member prairiedog. It's a bit surprising that we've not seen it fail repeatably before, considering that the regression tests have been exercising the faulty code path since 2009. The real-world impact is probably minimal, since it's unlikely anyone would be provoking the "TD["new"] is not a dictionary" error in production, and that's the only case that is actually wrong. Still, it's a bug affecting the regression tests, so patch all supported branches. In passing, remove dead variable "plstr", and demote "platt" to a local variable inside the PG_TRY block, since we don't need to clean it up in the PG_CATCH path.
Diffstat (limited to 'src/backend/utils/adt/jsonb_util.c')
0 files changed, 0 insertions, 0 deletions