summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2019-07-18 17:35:12 (GMT)
committerW. Felix Handte <w@felixhandte.com>2019-07-18 17:35:12 (GMT)
commit40943ba0c90483dbe229299c39d048ae79f08246 (patch)
tree6240e318024472a6efc0fedb3d45cf3888d28a00 /lib
parent369fb3900cbc73543f1bab276ca1b82abe402937 (diff)
downloadlz4-40943ba0c90483dbe229299c39d048ae79f08246.zip
lz4-40943ba0c90483dbe229299c39d048ae79f08246.tar.gz
lz4-40943ba0c90483dbe229299c39d048ae79f08246.tar.bz2
Unconditionally Clear `dictCtx`
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4hc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index d9e55a0..29288a5 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -998,11 +998,6 @@ static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBl
if (ctxPtr->end >= ctxPtr->base + ctxPtr->dictLimit + 4)
LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */
- /* cannot reference an extDict and a dictCtx at the same time */
- if (ctxPtr->dictCtx != NULL) {
- ctxPtr->dictCtx = NULL;
- }
-
/* Only one memory segment for extDict, so any previous extDict is lost at this stage */
ctxPtr->lowLimit = ctxPtr->dictLimit;
ctxPtr->dictLimit = (U32)(ctxPtr->end - ctxPtr->base);
@@ -1010,6 +1005,9 @@ static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBl
ctxPtr->base = newBlock - ctxPtr->dictLimit;
ctxPtr->end = newBlock;
ctxPtr->nextToUpdate = ctxPtr->dictLimit; /* match referencing will resume from there */
+
+ /* cannot reference an extDict and a dictCtx at the same time */
+ ctxPtr->dictCtx = NULL;
}
static int LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr,