From 5723038f7477e08b80965feb5083a8f6a6aca31a Mon Sep 17 00:00:00 2001 From: SaitTalhaNisanci Date: Thu, 17 Sep 2020 13:18:13 +0300 Subject: [PATCH] Comment user provided input memory allocation (#4163) --- src/backend/distributed/operations/citus_tools.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/operations/citus_tools.c b/src/backend/distributed/operations/citus_tools.c index fb6d6d65e..e522afa5b 100644 --- a/src/backend/distributed/operations/citus_tools.c +++ b/src/backend/distributed/operations/citus_tools.c @@ -112,7 +112,12 @@ master_run_on_worker(PG_FUNCTION_ARGS) "function return type are not compatible"))); } - /* prepare storage for status and result values */ + /* + * prepare storage for status and result values. + * commandCount is based on user input however, it is the length of list + * instead of a user given integer, hence this should be safe here in terms + * of memory allocation. + */ bool *statusArray = palloc0(commandCount * sizeof(bool)); StringInfo *resultArray = palloc0(commandCount * sizeof(StringInfo)); for (int commandIndex = 0; commandIndex < commandCount; commandIndex++)