]> 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)
committerJia Tan <jiat0218@gmail.com>
Sat, 16 Dec 2023 12:18:47 +0000 (20:18 +0800)
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.

src/liblzma/lzma/lzma_encoder.c

index 559c63eda1d255827b5d7a9eb6cd4271c83cf68c..79fdeca2902a2451a1e78e0f90dcdb2d931ae680 100644 (file)
@@ -712,6 +712,9 @@ static lzma_ret
 lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
                lzma_vli id, const void *options, lzma_lz_options *lz_options)
 {
+        if (options == NULL)
+                return LZMA_PROG_ERROR;
+
        lz->code = &lzma_encode;
        lz->set_out_limit = &lzma_lzma_set_out_limit;
        return lzma_lzma_encoder_create(