summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgabrielstedman <gabriwinter@gmail.com>2019-04-22 10:07:08 (GMT)
committergabrielstedman <gabriwinter@gmail.com>2019-04-22 10:07:08 (GMT)
commit84f978a2f3a787c7646ab3773fa7c41bddbb849e (patch)
treed78eba7983ce57993c028c3219003b54556dd5e8
parente31b6dc03ca464de55ebb403fb0ef6470d99e1a0 (diff)
downloadlz4-84f978a2f3a787c7646ab3773fa7c41bddbb849e.zip
lz4-84f978a2f3a787c7646ab3773fa7c41bddbb849e.tar.gz
lz4-84f978a2f3a787c7646ab3773fa7c41bddbb849e.tar.bz2
FR #598 - Correctly initialize cfinfo & cast malloc res to (char*)
-rw-r--r--programs/lz4io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 9aa2b94..175157e 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -1222,7 +1222,6 @@ static int LZ4IO_getCompressedFileInfo(const char* input_filename, LZ4F_compFil
size_t readSize = LZ4F_HEADER_SIZE_MAX;
LZ4F_errorCode_t errorCode;
dRess_t ress;
- // LZ4F_compFileInfo_t cfinfo = (LZ4F_compFileInfo_t) LZ4F_INIT_FILEINFO;
/* Open file */
FILE* const finput = LZ4IO_openSrcFile(input_filename);
if (finput==NULL) return 1;
@@ -1247,7 +1246,7 @@ static int LZ4IO_getCompressedFileInfo(const char* input_filename, LZ4F_compFil
e = strrchr(b, '.');
/* Allocate Memory */
- t = malloc( (e-b+1) * sizeof(char));
+ t = (char*)malloc( (e-b+1) * sizeof(char));
ress.srcBuffer = malloc(LZ4IO_dBufferSize);
if (!t || !ress.srcBuffer)
EXM_THROW(21, "Allocation error : not enough memory");
@@ -1332,6 +1331,7 @@ int LZ4IO_displayCompressedFilesInfo(const char** inFileNames, const size_t ifnI
DISPLAY("%16s\t%-20s\t%-20s\t%-10s\t%s\n","BlockChecksumFlag","Compressed", "Uncompressed", "Ratio", "Filename");
for(idx=0; idx<ifnIdx; idx++){
/* Get file info */
+ cfinfo = (LZ4F_compFileInfo_t) LZ4F_INIT_FILEINFO;
op_result=LZ4IO_getCompressedFileInfo(inFileNames[idx], &cfinfo);
if (op_result != 0){
DISPLAYLEVEL(1, "Failed to get frame info for file %s\n", inFileNames[idx]);