]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Improve lzma encoder init function consistency.
authorJia Tan <jiat0218@gmail.com>
Sat, 16 Dec 2023 12:18:47 +0000 (20:18 +0800)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 7 May 2024 14:57:51 +0000 (17:57 +0300)
lzma_encoder_init() did not check for NULL options, but
lzma2_encoder_init() did. This is more of a code style improvement than
anything else to help make lzma_encoder_init() and lzma2_encoder_init()
more similar.

(cherry picked from commit 019afd72e02339a6bf00c32bfb56f649c637dd6b)

src/liblzma/lzma/lzma_encoder.c

index bbbb5d2d7cdfadfb737e049dfb5c22760f17d5a4..01ca1b4f72c426a57a9d44b3522ad256b72048d7 100644 (file)
@@ -620,6 +620,9 @@ static lzma_ret
 lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
                const void *options, lzma_lz_options *lz_options)
 {
+        if (options == NULL)
+                return LZMA_PROG_ERROR;
+
        lz->code = &lzma_encode;
        return lzma_lzma_encoder_create(
                        &lz->coder, allocator, options, lz_options);