fmgr_info_cxt_security() screwing memory ?

Started by Luis Vargasover 18 years ago2 messageshackers
Jump to latest
#1Luis Vargas
Luis.Vargas@cl.cam.ac.uk

Hi, I'm calling an arbitrary user-defined function from the backend.
Although I can do it via FunctionCallInvoke, I have a weird problem when
calling fmgr_info. The call results in a argument variable (eventType)
being cleared. A gdb hardware watch says that the variable is modified by
fmgr_info_cxt_security (fmgr.c:185): "finfo->fn_extra = NULL"; Any ideas of
what is happening?

For simplicity, in the following snippet I have hardcoded foid to some
(PGPSQL) function id and removed the rest of the call-related statements.

static void execEventTypeFunc(char *eventType, Oid funcId)
{
FmgrInfo *finfo;
FunctionCallInfoData fcinfo;
Datum result;
Oid foid = 17283;

finfo = (FmgrInfo *) palloc0(sizeof(FmgrInfo));

fmgr_info(foid, finfo);

...
}

Thanks,

Luis Vargas

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Luis Vargas (#1)
Re: fmgr_info_cxt_security() screwing memory ?

Luis Vargas <Luis.Vargas@cl.cam.ac.uk> writes:

Hi, I'm calling an arbitrary user-defined function from the backend.
Although I can do it via FunctionCallInvoke, I have a weird problem when
calling fmgr_info. The call results in a argument variable (eventType)
being cleared. A gdb hardware watch says that the variable is modified by
fmgr_info_cxt_security (fmgr.c:185): "finfo->fn_extra = NULL"; Any ideas of
what is happening?

One wonders whether eventType points at already-pfreed memory. If not,
the problem must lie somewhere in the code you removed from the example.

regards, tom lane