diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 8dfea05846..ce292fec33 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -344,6 +344,12 @@ main(int argc, char **argv)
 	}
 
 	buffer = source->fetch_file(source, "global/pg_control", &size);
+
+	/* It's odd that memcmp, compares two structs with padding values unspecified.
+	 * Explicitly initialize with memset to avoid this.
+	 */
+	memset(&ControlFile_source, 0, sizeof(ControlFileData));
+
 	digestControlFile(&ControlFile_source, buffer, size);
 	pg_free(buffer);
 
@@ -632,6 +638,12 @@ perform_rewind(filemap_t *filemap, rewind_source *source,
 	 * minRecoveryPoint is up-to-date.
 	 */
 	buffer = source->fetch_file(source, "global/pg_control", &size);
+
+	/* It's odd that memcmp, compares two structs with padding values unspecified.
+	 * Explicitly initialize with memset to avoid this.
+	 */
+	memset(&ControlFile_source_after, 0, sizeof(ControlFileData));
+	
 	digestControlFile(&ControlFile_source_after, buffer, size);
 	pg_free(buffer);
