• Alvaro Herrera's avatar
    Fix coding rules violations in walreceiver.c · 89e434b5
    Alvaro Herrera authored
    1. Since commit b1a9bad9 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 9ed551e0 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 64233902 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 1bb25580 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/87h8vhtgj2.fsf@ansel.ydns.eu
    89e434b5
walreceiver.c 42.5 KB