aboutsummaryrefslogtreecommitdiff
path: root/lib/common/compress.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-12-04 01:33:45 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-19 16:24:56 +0100
commit47f24f2a8faf71395a1d054e9823beb000442cce (patch)
treedd01d8b69125b3dda444c9b92437ad0c5a0af9bc /lib/common/compress.c
parent4160b50a0b4c51f8b7191928cdf38d9fb0147fe2 (diff)
Implement rudimentary reference counting for sqfs_object_t
Implement grab/drop functions to increase/decrease reference count and destroy the object if the count drops to 0. Make sure that all objects that maintain internal references actually grab that reference, duplicate it in the copy function, drop it in the destroy handler. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common/compress.c')
-rw-r--r--lib/common/compress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/common/compress.c b/lib/common/compress.c
index b11efbd..1e0ca06 100644
--- a/lib/common/compress.c
+++ b/lib/common/compress.c
@@ -32,7 +32,7 @@ SQFS_COMPRESSOR compressor_get_default(void)
ret = sqfs_compressor_create(&cfg, &temp);
if (ret == 0) {
- sqfs_destroy(temp);
+ sqfs_drop(temp);
return cmp_ids[i];
}
}
@@ -64,7 +64,7 @@ void compressor_print_available(void)
have_compressor = false;
if (ret == 0) {
- sqfs_destroy(temp);
+ sqfs_drop(temp);
have_compressor = true;
} else {
#ifdef WITH_LZO