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

Commit51300b4

Browse files
committed
Fix use-after-release issue in PL/Sample
Introduced inadbe62d. Per buildfarm member prion, when usingRELCACHE_FORCE_RELEASE.
1 parentadbe62d commit51300b4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/test/modules/plsample/plsample.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ plsample_func_handler(PG_FUNCTION_ARGS)
9797
char*proname;
9898
Form_pg_typepg_type_entry;
9999
Oidresult_typioparam;
100+
Oidprorettype;
100101
FmgrInforesult_in_func;
101102
intnumargs;
102103

@@ -117,7 +118,6 @@ plsample_func_handler(PG_FUNCTION_ARGS)
117118
if (isnull)
118119
elog(ERROR,"could not find source text of function \"%s\"",
119120
proname);
120-
ReleaseSysCache(pl_tuple);
121121
source=DatumGetCString(DirectFunctionCall1(textout,ret));
122122
ereport(NOTICE,
123123
(errmsg("source text of function \"%s\": %s",
@@ -157,6 +157,10 @@ plsample_func_handler(PG_FUNCTION_ARGS)
157157
i,argnames[i],value)));
158158
}
159159

160+
/* Type of the result */
161+
prorettype=pl_struct->prorettype;
162+
ReleaseSysCache(pl_tuple);
163+
160164
/*
161165
* Get the required information for input conversion of the return value.
162166
*
@@ -165,13 +169,13 @@ plsample_func_handler(PG_FUNCTION_ARGS)
165169
* we can do here. This returns NULL except if the result type is text,
166170
* where the result is the source text of the function.
167171
*/
168-
if (pl_struct->prorettype!=TEXTOID)
172+
if (prorettype!=TEXTOID)
169173
PG_RETURN_NULL();
170174

171175
type_tuple=SearchSysCache1(TYPEOID,
172-
ObjectIdGetDatum(pl_struct->prorettype));
176+
ObjectIdGetDatum(prorettype));
173177
if (!HeapTupleIsValid(type_tuple))
174-
elog(ERROR,"cache lookup failed for type %u",pl_struct->prorettype);
178+
elog(ERROR,"cache lookup failed for type %u",prorettype);
175179
pg_type_entry= (Form_pg_type)GETSTRUCT(type_tuple);
176180
result_typioparam=getTypeIOParam(type_tuple);
177181

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp