lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
Subsystems (2)
[email protected]
maintainerPATCH 3/11 lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
From: Lasse Collin <[email protected]>
Subject: lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
s->dict.allocated was initialized to 0 but never set after a successful allocation, thus the code always thought that the dictionary buffer has to be reallocated.
Signed-off-by Lasse Collin <[email protected]>
Reported-by Yu Sun <[email protected]>
Acked-by Daniel Walker <[email protected]>
Cc "Yixia Si (yisi)" <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
lib/xz/xz_dec_lzma2.c | 1 + 1 file changed, 1 insertion(+)
lib/xz/xz_dec_lzma2.c renamed from lib/xz/xz_dec_lzma2.c~lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations +1 -0
@@ -1146,6 +1146,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_resetif (DEC_IS_DYNALLOC (s->dict.mode)) {if (s->dict.allocated < s->dict.size) { + s->dict.allocated = s->dict.size;vfree (s->dict.buf); s->dict.buf =vmalloc (s->dict.size);if (s->dict.buf ==NULL ) {
_