mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
Invalidate raczlib cache if re-using its memory
This commit is contained in:
1 parent
cdf49196b1
commit
f4abc0ffe4
1 file changed
+2
@@ -135,6 +135,8 @@ func (r *CodecReader) MakeReaderContext(
|
|||||||
buffer := []byte(nil)
|
buffer := []byte(nil)
|
||||||
if n := dictSize + 4; int64(cap(r.cachedDictionary)) >= n {
|
if n := dictSize + 4; int64(cap(r.cachedDictionary)) >= n {
|
||||||
buffer = r.cachedDictionary[:n]
|
buffer = r.cachedDictionary[:n]
|
||||||
|
// Invalidate the cached dictionary, as we are re-using its memory.
|
||||||
|
r.cachedDictionaryCRange = rac.Range{}
|
||||||
} else {
|
} else {
|
||||||
buffer = make([]byte, n)
|
buffer = make([]byte, n)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user