diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2010-01-01 00:29:10 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2010-01-01 00:29:10 +0200 |
commit | 8ea8dc754a7a5bc2d60db1eac201839cabdab6a1 (patch) | |
tree | 2d05a7bd808749d1f629b2f0eaad522c33f46280 /src/liblzma/common/stream_decoder.c | |
parent | Revised the Index handling code. (diff) | |
download | xz-8ea8dc754a7a5bc2d60db1eac201839cabdab6a1.tar.xz |
Fix _memconfig() functions.
This affects lzma_memusage() and lzma_memlimit_get().
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/common/stream_decoder.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/liblzma/common/stream_decoder.c b/src/liblzma/common/stream_decoder.c index 680fc53e..60cc8247 100644 --- a/src/liblzma/common/stream_decoder.c +++ b/src/liblzma/common/stream_decoder.c @@ -383,12 +383,15 @@ static lzma_ret stream_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; } |