aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/index_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/index_decoder.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/liblzma/common/index_decoder.c b/src/liblzma/common/index_decoder.c
index a3ea791f..86a22971 100644
--- a/src/liblzma/common/index_decoder.c
+++ b/src/liblzma/common/index_decoder.c
@@ -219,12 +219,14 @@ index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
*memusage = lzma_index_memusage(1, coder->count);
+ *old_memlimit = coder->memlimit;
- if (new_memlimit != 0 && new_memlimit < *memusage)
- return LZMA_MEMLIMIT_ERROR;
+ if (new_memlimit != 0) {
+ if (new_memlimit < *memusage)
+ return LZMA_MEMLIMIT_ERROR;
- *old_memlimit = coder->memlimit;
- coder->memlimit = new_memlimit;
+ coder->memlimit = new_memlimit;
+ }
return LZMA_OK;
}