TimestampTz commit_time)
 {
    ReorderBufferTXN *txn;
-   ReorderBufferIterTXNState *iterstate = NULL;
+   ReorderBufferIterTXNState *volatile iterstate = NULL;
    ReorderBufferChange *change;
 
    volatile CommandId command_id = FirstCommandId;
 
    PG_TRY();
    {
-
        /*
         * Decoding needs access to syscaches et al., which in turn use
         * heavyweight locks and such. Thus we need to have enough state
            }
        }
 
+       /* clean up the iterator */
        ReorderBufferIterTXNFinish(rb, iterstate);
+       iterstate = NULL;
 
        /* call commit callback */
        rb->commit(rb, txn, commit_lsn);
     */
    if (txn->base_snapshot != NULL && txn->ninvalidations > 0)
    {
-       bool use_subtxn = IsTransactionOrTransactionBlock();
+       bool        use_subtxn = IsTransactionOrTransactionBlock();
 
        if (use_subtxn)
            BeginInternalSubTransaction("replay");