Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc08c852

Browse files
author
Neil Conway
committed
In PLy_function_build_args(), the code loops repeatedly, constructing
one argument at a time and then inserting the argument into a Pythonlist via PyList_SetItem(). This "steals" the reference to the argument:that is, the reference to the new list member is now held by the Pythonlist itself. This works fine, except if an elog occurs. This causes thefunction's PG_CATCH() block to be invoked, which decrements thereference counts on both the current argument and the list of arguments.If the elog happens to occur during the second or subsequent iterationof the loop, the reference count on the current argument will bedecremented twice.The fix is simple: set the local pointer to the current argument to NULLimmediately after adding it to the argument list. This ensures that thePy_XDECREF() in the PG_CATCH() block doesn't double-decrement.
1 parent42ff6a0 commitc08c852

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/pl/plpython/plpython.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
3030
*
3131
* IDENTIFICATION
32-
*$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.69 2006/01/09 02:47:09 neilc Exp $
32+
*$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.70 2006/01/10 00:33:12 neilc Exp $
3333
*
3434
*********************************************************************
3535
*/
@@ -895,6 +895,7 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc)
895895
* FIXME -- error check this
896896
*/
897897
PyList_SetItem(args,i,arg);
898+
arg=NULL;
898899
}
899900
}
900901
PG_CATCH();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp