diff options
author | Yann Collet <cyan@fb.com> | 2017-08-10 01:00:48 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-08-10 01:00:48 (GMT) |
commit | bf8daa2fd52fe4a87b59f74e3f3c249f57218391 (patch) | |
tree | 57d51337538e8f8f12caaa49d5ee2bce9e5d46a6 | |
parent | 31f2cdf4d214edcd9d4496058b0f9a4c4f8c0fad (diff) | |
download | lz4-bf8daa2fd52fe4a87b59f74e3f3c249f57218391.zip lz4-bf8daa2fd52fe4a87b59f74e3f3c249f57218391.tar.gz lz4-bf8daa2fd52fe4a87b59f74e3f3c249f57218391.tar.bz2 |
fixed uninitialization error in lz4frame
-rw-r--r-- | lib/lz4frame.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c index f9af991..07cbf56 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -327,10 +327,6 @@ size_t LZ4F_compressFrame_usingCDict(void* dstBuffer, size_t dstCapacity, memset(&cctxI, 0, sizeof(cctxI)); cctxI.version = LZ4F_VERSION; cctxI.maxBufferSize = 5 MB; /* mess with real buffer size to prevent dynamic allocation; works only because autoflush==1 & stableSrc==1 */ - if (prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { - cctxI.lz4CtxPtr = &lz4ctx; - cctxI.lz4CtxLevel = 1; - } /* fast compression context pre-created on stack */ if (preferencesPtr!=NULL) prefs = *preferencesPtr; @@ -344,6 +340,11 @@ size_t LZ4F_compressFrame_usingCDict(void* dstBuffer, size_t dstCapacity, if (srcSize <= LZ4F_getBlockSize(prefs.frameInfo.blockSizeID)) prefs.frameInfo.blockMode = LZ4F_blockIndependent; /* only one block => no need for inter-block link */ + if (prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { + cctxI.lz4CtxPtr = &lz4ctx; + cctxI.lz4CtxLevel = 1; + } /* fast compression context pre-created on stack */ + memset(&options, 0, sizeof(options)); options.stableSrc = 1; |