diff options
Diffstat (limited to 'src/archive/iso9660_archive_plugin.c')
-rw-r--r-- | src/archive/iso9660_archive_plugin.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/archive/iso9660_archive_plugin.c b/src/archive/iso9660_archive_plugin.c index 3d5f33896..0d32b9b1b 100644 --- a/src/archive/iso9660_archive_plugin.c +++ b/src/archive/iso9660_archive_plugin.c @@ -25,6 +25,7 @@ #include "archive/iso9660_archive_plugin.h" #include "archive_api.h" #include "input_plugin.h" +#include "refcount.h" #include <cdio/cdio.h> #include <cdio/iso9660.h> @@ -37,6 +38,8 @@ struct iso9660_archive_file { struct archive_file base; + struct refcount ref; + iso9660_t *iso; GSList *list; GSList *iter; @@ -93,6 +96,7 @@ iso9660_archive_open(const char *pathname, GError **error_r) g_new(struct iso9660_archive_file, 1); archive_file_init(&context->base, &iso9660_archive_plugin); + refcount_init(&context->ref); context->list = NULL; @@ -139,8 +143,11 @@ iso9660_archive_close(struct archive_file *file) { struct iso9660_archive_file *context = (struct iso9660_archive_file *)file; - GSList *tmp; + + if (!refcount_dec(&context->ref)) + return; + if (context->list) { //free list for (tmp = context->list; tmp != NULL; tmp = g_slist_next(tmp)) @@ -192,6 +199,9 @@ iso9660_archive_open_stream(struct archive_file *file, struct input_stream *is, is->size = iis->statbuf->size; iis->max_blocks = CEILING(iis->statbuf->size, ISO_BLOCKSIZE); + + refcount_inc(&context->ref); + return true; } |