Commit 6cc2da0a for xz
commit 6cc2da0a4b180b71cb6e781c897052def103ad3e
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Sun Nov 2 12:57:00 2025 +0200
liblzma: Refactor a loop in lzma_filters_copy()
Arguably it's nicer if i doesn't wrap around when the loop terminates.
Fixes: Coverity CID 464589
Fixes: 6d118a0b9def ("Add lzma_filters_copy().")
diff --git a/src/liblzma/common/filter_common.c b/src/liblzma/common/filter_common.c
index d15d9cc9..6c06c78d 100644
--- a/src/liblzma/common/filter_common.c
+++ b/src/liblzma/common/filter_common.c
@@ -213,8 +213,8 @@ lzma_filters_copy(const lzma_filter *src, lzma_filter *real_dest,
error:
// Free the options which we have already allocated.
- while (i-- > 0)
- lzma_free(dest[i].options, allocator);
+ while (i > 0)
+ lzma_free(dest[--i].options, allocator);
return ret;
}