]> wimlib.net Git - wimlib/commitdiff
wimlib_create_{de,}compressor(): Check ctype first
authorEric Biggers <ebiggers3@gmail.com>
Wed, 20 Aug 2014 02:04:39 +0000 (21:04 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 20 Aug 2014 02:04:43 +0000 (21:04 -0500)
src/compress.c
src/decompress.c

index 4c99dab145db7b04c5f6fb80f6207d6537b95179..efbd2085418f3685e8c0a52ec99c762d02e8b7ac 100644 (file)
@@ -111,15 +111,15 @@ wimlib_create_compressor(enum wimlib_compression_type ctype,
 {
        struct wimlib_compressor *c;
 
+       if (!compressor_ctype_valid(ctype))
+               return WIMLIB_ERR_INVALID_COMPRESSION_TYPE;
+
        if (c_ret == NULL)
                return WIMLIB_ERR_INVALID_PARAM;
 
        if (max_block_size == 0)
                return WIMLIB_ERR_INVALID_PARAM;
 
-       if (!compressor_ctype_valid(ctype))
-               return WIMLIB_ERR_INVALID_COMPRESSION_TYPE;
-
        c = MALLOC(sizeof(*c));
        if (c == NULL)
                return WIMLIB_ERR_NOMEM;
index 4ebd940d0ac074ce7d8e52ca122b84b09c9ce159..b8ed8dfcfe03186b33a119c4069e31d2709f5bca 100644 (file)
@@ -59,15 +59,15 @@ wimlib_create_decompressor(enum wimlib_compression_type ctype,
 {
        struct wimlib_decompressor *dec;
 
+       if (!decompressor_ctype_valid(ctype))
+               return WIMLIB_ERR_INVALID_COMPRESSION_TYPE;
+
        if (dec_ret == NULL)
                return WIMLIB_ERR_INVALID_PARAM;
 
        if (max_block_size == 0)
                return WIMLIB_ERR_INVALID_PARAM;
 
-       if (!decompressor_ctype_valid(ctype))
-               return WIMLIB_ERR_INVALID_COMPRESSION_TYPE;
-
        dec = MALLOC(sizeof(*dec));
        if (dec == NULL)
                return WIMLIB_ERR_NOMEM;