]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/fpga_compress.c
FIX: Coverity scan, remove a resource leak, wrong varible type.
[proxmark3-svn] / client / fpga_compress.c
index 3d5ba7cadb0bdf460622b142579801966f83b7d9..9bafead9a4b6dec38549ca1ad0a787ce6eef63ed 100644 (file)
@@ -91,6 +91,7 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile)
                        for(uint16_t j = 0; j < num_infiles; j++) {
                                fclose(infile[j]);
                        }
                        for(uint16_t j = 0; j < num_infiles; j++) {
                                fclose(infile[j]);
                        }
+                       free(fpga_config);
                        return(EXIT_FAILURE);
                }
 
                        return(EXIT_FAILURE);
                }
 
@@ -138,7 +139,7 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile)
                ret = deflate(&compressed_fpga_stream, Z_FINISH);
        }
        
                ret = deflate(&compressed_fpga_stream, Z_FINISH);
        }
        
-       fprintf(stderr, "compressed %lu input bytes to %u output bytes\n", i, compressed_fpga_stream.total_out);
+       fprintf(stderr, "compressed %u input bytes to %lu output bytes\n", i, compressed_fpga_stream.total_out);
 
        if (ret != Z_STREAM_END) {
                fprintf(stderr, "Error in deflate(): %d %s\n", ret, compressed_fpga_stream.msg);
 
        if (ret != Z_STREAM_END) {
                fprintf(stderr, "Error in deflate(): %d %s\n", ret, compressed_fpga_stream.msg);
@@ -195,7 +196,7 @@ int zlib_decompress(FILE *infile, FILE *outfile)
                        compressed_fpga_stream.next_in = inbuf;
                        uint16_t i = 0;
                        do {
                        compressed_fpga_stream.next_in = inbuf;
                        uint16_t i = 0;
                        do {
-                               uint8_t c = fgetc(infile);
+                               int c = fgetc(infile);
                                if (!feof(infile)) {
                                        inbuf[i++] = c;
                                        compressed_fpga_stream.avail_in++;
                                if (!feof(infile)) {
                                        inbuf[i++] = c;
                                        compressed_fpga_stream.avail_in++;
Impressum, Datenschutz