mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 03:29:01 -07:00
fix coverity CID 344485, 344482, 344481
This commit is contained in:
parent
6a444eb208
commit
436fedcbe4
1 changed files with 9 additions and 2 deletions
|
@ -40,9 +40,13 @@ static bool all_feof(FILE *infile[], uint8_t num_infiles) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
||||||
uint8_t *fpga_config;
|
|
||||||
|
|
||||||
fpga_config = calloc(num_infiles * FPGA_CONFIG_SIZE, sizeof(uint8_t));
|
uint8_t *fpga_config = calloc(num_infiles * FPGA_CONFIG_SIZE, sizeof(uint8_t));
|
||||||
|
if (fpga_config == NULL) {
|
||||||
|
fprintf(stderr, "failed to allocate memory");
|
||||||
|
return (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
// read the input files. Interleave them into fpga_config[]
|
// read the input files. Interleave them into fpga_config[]
|
||||||
uint32_t total_size = 0;
|
uint32_t total_size = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -99,6 +103,9 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
||||||
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
|
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
|
||||||
if (cmp_bytes < 0 ){
|
if (cmp_bytes < 0 ){
|
||||||
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
|
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
|
||||||
|
free(ring_buffer);
|
||||||
|
free(outbuf);
|
||||||
|
free(fpga_config);
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
fwrite(&cmp_bytes, sizeof(int), 1, outfile);
|
fwrite(&cmp_bytes, sizeof(int), 1, outfile);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue