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/index_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 'src/liblzma/common/index_decoder.c')
-rw-r--r-- | src/liblzma/common/index_decoder.c | 10 |
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; } |