From 362a0e43a37aa5a6316bcf895def4eda8391bb2e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 2 Dec 2014 13:17:38 -0700 Subject: [PATCH] bzlib: Update destLen even on error This allows the caller to easily detect how much of the destination buffer has been used. Signed-off-by: Simon Glass --- lib/bzip2/bzlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bzip2/bzlib.c b/lib/bzip2/bzlib.c index 5844e187c0..9262e4055e 100644 --- a/lib/bzip2/bzlib.c +++ b/lib/bzip2/bzlib.c @@ -1350,11 +1350,11 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) strm.avail_out = *destLen; ret = BZ2_bzDecompress ( &strm ); + *destLen -= strm.avail_out; if (ret == BZ_OK) goto output_overflow_or_eof; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ - *destLen -= strm.avail_out; BZ2_bzDecompressEnd ( &strm ); return BZ_OK; -- 2.25.1