summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/lockfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/lockfuncs.c')
-rw-r--r--src/backend/utils/adt/lockfuncs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 4e517b28e17..944cd6df03f 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -559,13 +559,14 @@ pg_safe_snapshot_blocking_pids(PG_FUNCTION_ARGS)
int *blockers;
int num_blockers;
Datum *blocker_datums;
+ int max_backends = GetMaxBackends();
/* A buffer big enough for any possible blocker list without truncation */
- blockers = (int *) palloc(GetMaxBackends() * sizeof(int));
+ blockers = (int *) palloc(max_backends * sizeof(int));
/* Collect a snapshot of processes waited for by GetSafeSnapshot */
num_blockers =
- GetSafeSnapshotBlockingPids(blocked_pid, blockers, GetMaxBackends());
+ GetSafeSnapshotBlockingPids(blocked_pid, blockers, max_backends);
/* Convert int array to Datum array */
if (num_blockers > 0)