Avoid memcpy() with same source and destination in pgstat_recv_replslot.

Same type of issue as in commit 53d4f5fef and earlier fixes; also
found by apparently-more-picky-than-the-buildfarm valgrind testing.
This one is an oversight in commit 986816750.  Since that's new in
HEAD, no need for a back-patch.
pull/59/head
Tom Lane 5 years ago
parent 11072e8693
commit ed6329cfa9
  1. 4
      src/backend/postmaster/pgstat.c

@ -6916,15 +6916,15 @@ pgstat_recv_replslot(PgStat_MsgReplSlot *msg, int len)
return;
/* it must be a valid replication slot index */
Assert(idx >= 0 && idx < max_replication_slots);
Assert(idx < nReplSlotStats);
if (msg->m_drop)
{
/* Remove the replication slot statistics with the given name */
if (idx < nReplSlotStats - 1)
memcpy(&replSlotStats[idx], &replSlotStats[nReplSlotStats - 1],
sizeof(PgStat_ReplSlotStats));
nReplSlotStats--;
Assert(nReplSlotStats >= 0);
}
else
{

Loading…
Cancel
Save