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

Commitec76265

Browse files
committed
Don't leak the temporary PLyProcedure struct we create for inline plpython
blocks.Investigation by Jan Urbański, though I didn't use his patch.
1 parent647f8b3 commitec76265

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/pl/plpython/plpython.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
592592
FunctionCallInfoDatafake_fcinfo;
593593
FmgrInfoflinfo;
594594
PLyProcedure*save_curr_proc;
595-
PLyProcedure*volatileproc=NULL;
595+
PLyProcedureproc;
596596
ErrorContextCallbackplerrcontext;
597597

598598
if (SPI_connect()!=SPI_OK_CONNECT)
@@ -613,26 +613,26 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
613613
flinfo.fn_oid=InvalidOid;
614614
flinfo.fn_mcxt=CurrentMemoryContext;
615615

616-
proc=PLy_malloc0(sizeof(PLyProcedure));
617-
proc->pyname=PLy_strdup("__plpython_inline_block");
618-
proc->result.out.d.typoid=VOIDOID;
616+
MemSet(&proc,0,sizeof(PLyProcedure));
617+
proc.pyname=PLy_strdup("__plpython_inline_block");
618+
proc.result.out.d.typoid=VOIDOID;
619619

620620
PG_TRY();
621621
{
622-
PLy_procedure_compile(proc,codeblock->source_text);
623-
PLy_curr_procedure=proc;
624-
PLy_function_handler(&fake_fcinfo,proc);
622+
PLy_procedure_compile(&proc,codeblock->source_text);
623+
PLy_curr_procedure=&proc;
624+
PLy_function_handler(&fake_fcinfo,&proc);
625625
}
626626
PG_CATCH();
627627
{
628-
PLy_procedure_delete(proc);
628+
PLy_procedure_delete(&proc);
629629
PLy_curr_procedure=save_curr_proc;
630630
PyErr_Clear();
631631
PG_RE_THROW();
632632
}
633633
PG_END_TRY();
634634

635-
PLy_procedure_delete(proc);
635+
PLy_procedure_delete(&proc);
636636

637637
/* Pop the error context stack */
638638
error_context_stack=plerrcontext.previous;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp