diff options
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/functions.c | 6 | ||||
-rw-r--r-- | src/backend/executor/spi.c | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 84be37c7a39..6c3eff7c584 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -896,9 +896,9 @@ postquel_sub_params(SQLFunctionCachePtr fcache, if (fcache->paramLI == NULL) { - /* sizeof(ParamListInfoData) includes the first array element */ - paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) + - (nargs - 1) * sizeof(ParamExternData)); + paramLI = (ParamListInfo) + palloc(offsetof(ParamListInfoData, params) + + nargs * sizeof(ParamExternData)); /* we have static list of params, so no hooks needed */ paramLI->paramFetch = NULL; paramLI->paramFetchArg = NULL; diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 4b86e910df8..b3c05025bc0 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -2290,9 +2290,8 @@ _SPI_convert_params(int nargs, Oid *argtypes, { int i; - /* sizeof(ParamListInfoData) includes the first array element */ - paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) + - (nargs - 1) * sizeof(ParamExternData)); + paramLI = (ParamListInfo) palloc(offsetof(ParamListInfoData, params) + + nargs * sizeof(ParamExternData)); /* we have static list of params, so no hooks needed */ paramLI->paramFetch = NULL; paramLI->paramFetchArg = NULL; |