summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r--util/cbfstool/cbfstool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index d2df1cc008..c7a6079333 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -595,6 +595,9 @@ static int cbfstool_convert_raw(struct buffer *buffer,
return -1;
memcpy(compressed, buffer->data + 8, compressed_size);
} else {
+ if (param.compression == CBFS_COMPRESS_NONE)
+ goto out;
+
compress = compression_function(param.compression);
if (!compress)
return -1;
@@ -606,7 +609,7 @@ static int cbfstool_convert_raw(struct buffer *buffer,
compressed, &compressed_size)) {
WARN("Compression failed - disabled\n");
free(compressed);
- return 0;
+ goto out;
}
}
@@ -626,6 +629,7 @@ static int cbfstool_convert_raw(struct buffer *buffer,
buffer->data = compressed;
buffer->size = compressed_size;
+out:
header->len = htonl(buffer->size);
return 0;
}