aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_add_filter_compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_write_add_filter_compress.c')
-rw-r--r--libarchive/archive_write_add_filter_compress.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/libarchive/archive_write_add_filter_compress.c b/libarchive/archive_write_add_filter_compress.c
index 26fcef4d42bc..d404fae7dba4 100644
--- a/libarchive/archive_write_add_filter_compress.c
+++ b/libarchive/archive_write_add_filter_compress.c
@@ -146,17 +146,12 @@ archive_write_add_filter_compress(struct archive *_a)
static int
archive_compressor_compress_open(struct archive_write_filter *f)
{
- int ret;
struct private_data *state;
size_t bs = 65536, bpb;
f->code = ARCHIVE_FILTER_COMPRESS;
f->name = "compress";
- ret = __archive_write_open_filter(f->next_filter);
- if (ret != ARCHIVE_OK)
- return (ret);
-
state = (struct private_data *)calloc(1, sizeof(*state));
if (state == NULL) {
archive_set_error(f->archive, ENOMEM,
@@ -426,30 +421,27 @@ static int
archive_compressor_compress_close(struct archive_write_filter *f)
{
struct private_data *state = (struct private_data *)f->data;
- int ret, ret2;
+ int ret;
ret = output_code(f, state->cur_code);
if (ret != ARCHIVE_OK)
- goto cleanup;
+ return ret;
ret = output_flush(f);
if (ret != ARCHIVE_OK)
- goto cleanup;
+ return ret;
/* Write the last block */
ret = __archive_write_filter(f->next_filter,
state->compressed, state->compressed_offset);
-cleanup:
- ret2 = __archive_write_close_filter(f->next_filter);
- if (ret > ret2)
- ret = ret2;
- free(state->compressed);
- free(state);
return (ret);
}
static int
archive_compressor_compress_free(struct archive_write_filter *f)
{
- (void)f; /* UNUSED */
+ struct private_data *state = (struct private_data *)f->data;
+
+ free(state->compressed);
+ free(state);
return (ARCHIVE_OK);
}