@@ -144,7 +144,8 @@ static void verify_control_file(const char *controlpath,
144
144
static void report_extra_backup_files (verifier_context * context );
145
145
static void verify_backup_checksums (verifier_context * context );
146
146
static void verify_file_checksum (verifier_context * context ,
147
- manifest_file * m , char * fullpath );
147
+ manifest_file * m , char * fullpath ,
148
+ uint8 * buffer );
148
149
static void parse_required_wal (verifier_context * context ,
149
150
char * pg_waldump_path ,
150
151
char * wal_directory );
@@ -480,8 +481,8 @@ parse_manifest_file(char *manifest_path)
480
481
(long long int ) statbuf .st_size );
481
482
}
482
483
bytes_left -= rc ;
483
- json_parse_manifest_incremental_chunk (
484
- inc_state , buffer , rc , bytes_left == 0 );
484
+ json_parse_manifest_incremental_chunk (inc_state , buffer , rc ,
485
+ bytes_left == 0 );
485
486
}
486
487
487
488
/* Release the incremental state memory */
@@ -812,9 +813,12 @@ verify_backup_checksums(verifier_context *context)
812
813
manifest_data * manifest = context -> manifest ;
813
814
manifest_files_iterator it ;
814
815
manifest_file * m ;
816
+ uint8 * buffer ;
815
817
816
818
progress_report (false);
817
819
820
+ buffer = pg_malloc (READ_CHUNK_SIZE * sizeof (uint8 ));
821
+
818
822
manifest_files_start_iterate (manifest -> files , & it );
819
823
while ((m = manifest_files_iterate (manifest -> files , & it )) != NULL )
820
824
{
@@ -828,13 +832,15 @@ verify_backup_checksums(verifier_context *context)
828
832
m -> pathname );
829
833
830
834
/* Do the actual checksum verification. */
831
- verify_file_checksum (context , m , fullpath );
835
+ verify_file_checksum (context , m , fullpath , buffer );
832
836
833
837
/* Avoid leaking memory. */
834
838
pfree (fullpath );
835
839
}
836
840
}
837
841
842
+ pfree (buffer );
843
+
838
844
progress_report (true);
839
845
}
840
846
@@ -843,14 +849,13 @@ verify_backup_checksums(verifier_context *context)
843
849
*/
844
850
static void
845
851
verify_file_checksum (verifier_context * context , manifest_file * m ,
846
- char * fullpath )
852
+ char * fullpath , uint8 * buffer )
847
853
{
848
854
pg_checksum_context checksum_ctx ;
849
855
char * relpath = m -> pathname ;
850
856
int fd ;
851
857
int rc ;
852
858
size_t bytes_read = 0 ;
853
- uint8 buffer [READ_CHUNK_SIZE ];
854
859
uint8 checksumbuf [PG_CHECKSUM_MAX_LENGTH ];
855
860
int checksumlen ;
856
861
0 commit comments