Fix coding rules violations in walreceiver.c
authorAlvaro Herrera
Tue, 3 Oct 2017 12:58:25 +0000 (14:58 +0200)
committerAlvaro Herrera
Tue, 3 Oct 2017 12:58:25 +0000 (14:58 +0200)
commitad40d5f74585d1f14ea4b73c20fb5b2dabfb153f
tree634e9c14fc7019ac78a3448ae84e54f7ef080ee1
parent5df0e99bea1c3e5fbffa7fbd0982da88ea149bb6
Fix coding rules violations in walreceiver.c

1. Since commit b1a9bad9e744 we had pstrdup() inside a
spinlock-protected critical section; reported by Andreas Seltenreich.
Turn those into strlcpy() to stack-allocated variables instead.
Backpatch to 9.6.

2. Since commit 9ed551e0a4fd we had a pfree() uselessly inside a
spinlock-protected critical section.  Tom Lane noticed in code review.
Move down.  Backpatch to 9.6.

3. Since commit 64233902d22b we had GetCurrentTimestamp() (a kernel
call) inside a spinlock-protected critical section.  Tom Lane noticed in
code review.  Move it up.  Backpatch to 9.2.

4. Since commit 1bb2558046cc we did elog(PANIC) while holding spinlock.
Tom Lane noticed in code review.  Release spinlock before dying.
Backpatch to 9.2.

Discussion: https://postgr.es/m/[email protected]
src/backend/replication/walreceiver.c