Invalidate raczlib cache if re-using its memory

This commit is contained in:
Nigel Tao committed 2019-08-08 12:10:40 +10:00
1 parent cdf49196b1
commit f4abc0ffe4
1 file changed
+2
+2
View File
@@ -135,6 +135,8 @@ func (r *CodecReader) MakeReaderContext(
buffer := []byte(nil)
if n := dictSize + 4; int64(cap(r.cachedDictionary)) >= n {
buffer = r.cachedDictionary[:n]
// Invalidate the cached dictionary, as we are re-using its memory.
r.cachedDictionaryCRange = rac.Range{}
} else {
buffer = make([]byte, n)
}