Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cae4974

Browse files
Dynamic array required within pg_stat_replication.
1 parent dcfe3f6 commit cae4974

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/replication/walsender.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
13221322
Tuplestorestate *tupstore;
13231323
MemoryContext per_query_ctx;
13241324
MemoryContext oldcontext;
1325-
int sync_priority[max_wal_senders];
1325+
int *sync_priority;
13261326
int priority = 0;
13271327
int sync_standby = -1;
13281328
int i;
@@ -1357,6 +1357,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
13571357
* lock acquisitions and to allow us to evaluate who is the current
13581358
* sync standby. This code must match the code in SyncRepReleaseWaiters().
13591359
*/
1360+
sync_priority = palloc(sizeof(int) * max_wal_senders);
13601361
LWLockAcquire(SyncRepLock, LW_SHARED);
13611362
for (i = 0; i < max_wal_senders; i++)
13621363
{
@@ -1456,6 +1457,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
14561457

14571458
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
14581459
}
1460+
pfree(sync_priority);
14591461

14601462
/* clean up and return the tuplestore */
14611463
tuplestore_donestoring(tupstore);

0 commit comments

Comments
 (0)