From a4458395b4e8227b7f125ab99cea6a0a6d87ee8f Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 13 Jun 2014 23:31:33 -0500 Subject: [PATCH] compress.c: Always include base compressor size When the struct compressor_ops does not provide get_needed_memory(), still include the size of the struct wimlib_compressor. --- src/compress.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compress.c b/src/compress.c index 84044077..039836af 100644 --- a/src/compress.c +++ b/src/compress.c @@ -97,13 +97,12 @@ wimlib_get_compressor_needed_memory(enum wimlib_compression_type ctype, { const struct compressor_ops *ops; const struct wimlib_compressor_params_header *params; + u64 size; if (!compressor_ctype_valid(ctype)) return 0; ops = compressor_ops[ctype]; - if (ops->get_needed_memory == NULL) - return 0; if (extra_params) { params = extra_params; @@ -113,8 +112,10 @@ wimlib_get_compressor_needed_memory(enum wimlib_compression_type ctype, params = compressor_default_params[ctype]; } - return sizeof(struct wimlib_compressor) + - ops->get_needed_memory(max_block_size, params); + size = sizeof(struct wimlib_compressor); + if (ops->get_needed_memory) + size += ops->get_needed_memory(max_block_size, params); + return size; } -- 2.43.0