lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
[platform/kernel/linux-rpi.git] / lib / xz / xz_dec_lzma2.c
index 08c3c80..156f26f 100644 (file)
@@ -1146,6 +1146,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
 
                if (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) {