aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/common.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-05 17:51:38 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-07 02:44:10 +0200
commit9c61e28d9b9faf6bd8b4e9b8d28ed79b441fbeb6 (patch)
treefe04b883ca1343e8d088ffa802b488d435bf086e /lib/sqfs/block_processor/common.c
parent09727f7523761cf57d8b90042af78088f0d4ef7f (diff)
block processor: add an internal common cleanup function
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/common.c')
-rw-r--r--lib/sqfs/block_processor/common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index 6171632..11cbd51 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -270,6 +270,22 @@ fail_outblk:
return err;
}
+void block_processor_cleanup(sqfs_block_processor_t *base)
+{
+ sqfs_block_t *it;
+
+ if (base->frag_block != NULL)
+ release_old_block(base, base->frag_block);
+
+ free(base->blk_current);
+
+ while (base->free_list != NULL) {
+ it = base->free_list;
+ base->free_list = it->next;
+ free(it);
+ }
+}
+
int block_processor_init(sqfs_block_processor_t *base, size_t max_block_size,
sqfs_compressor_t *cmp, sqfs_block_writer_t *wr,
sqfs_frag_table_t *tbl)