]> granicus.if.org Git - postgresql/commitdiff
Fix silly nil-pointer-dereference bug introduced in commit d5f6f13f8.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Nov 2016 16:29:40 +0000 (11:29 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Nov 2016 16:29:40 +0000 (11:29 -0500)
Don't fetch record->xl_info before we've verified that record isn't
NULL.  Per Coverity.

Michael Paquier

src/backend/access/transam/xlog.c

index 813f6467fdfcfff30c7c830e2a4de0b347ce1908..6cec02797a362a9adfdd57fc9eaeb6116ae86cd8 100644 (file)
@@ -7812,7 +7812,6 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr,
        }
 
        record = ReadRecord(xlogreader, RecPtr, LOG, true);
-       info = record->xl_info & ~XLR_INFO_MASK;
 
        if (record == NULL)
        {
@@ -7855,6 +7854,7 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr,
                }
                return NULL;
        }
+       info = record->xl_info & ~XLR_INFO_MASK;
        if (info != XLOG_CHECKPOINT_SHUTDOWN &&
                info != XLOG_CHECKPOINT_ONLINE)
        {