aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/alone_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/alone_decoder.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/liblzma/common/alone_decoder.c b/src/liblzma/common/alone_decoder.c
index fa7fb839..039b4285 100644
--- a/src/liblzma/common/alone_decoder.c
+++ b/src/liblzma/common/alone_decoder.c
@@ -173,12 +173,15 @@ static lzma_ret
alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
- if (new_memlimit != 0 && new_memlimit < coder->memusage)
- return LZMA_MEMLIMIT_ERROR;
-
*memusage = coder->memusage;
*old_memlimit = coder->memlimit;
- coder->memlimit = new_memlimit;
+
+ if (new_memlimit != 0) {
+ if (new_memlimit < coder->memusage)
+ return LZMA_MEMLIMIT_ERROR;
+
+ coder->memlimit = new_memlimit;
+ }
return LZMA_OK;
}