aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-15 20:26:38 +0100
committerMax Kellermann <max@duempel.org>2009-12-15 20:26:38 +0100
commit530e480748854f43819c3dd1dbe6418c343b4f64 (patch)
tree488824927e465de0e55b8d10f6c03389f7deeeab /src
parent95c3f283ea5a50a344b63af82718ac765229e8da (diff)
parent9179f108a540dcd27dafeb015778cc4dd873dfe5 (diff)
Merge branch 'v0.15.x'
Conflicts: src/archive/bz2_plugin.c src/archive_api.h src/input/file_input_plugin.c test/run_input.c
Diffstat (limited to 'src')
-rw-r--r--src/archive/bz2_plugin.c5
-rw-r--r--src/archive/iso_plugin.c5
-rw-r--r--src/archive/zip_plugin.c5
-rw-r--r--src/archive_plugin.h3
-rw-r--r--src/input/archive_input_plugin.c1
5 files changed, 15 insertions, 4 deletions
diff --git a/src/archive/bz2_plugin.c b/src/archive/bz2_plugin.c
index 20f8a427..693dd4db 100644
--- a/src/archive/bz2_plugin.c
+++ b/src/archive/bz2_plugin.c
@@ -144,8 +144,7 @@ bz2_close(struct archive_file *file)
{
bz2_context *context = (bz2_context *) file;
- if (context->name)
- g_free(context->name);
+ g_free(context->name);
input_stream_close(&context->istream);
g_free(context);
@@ -179,6 +178,8 @@ bz2_is_close(struct input_stream *is)
bz2_context *context = (bz2_context *) is->data;
bz2_destroy(context);
is->data = NULL;
+
+ bz2_close((struct archive_file *)context);
}
static bool
diff --git a/src/archive/iso_plugin.c b/src/archive/iso_plugin.c
index 04e0cfb3..b56653d5 100644
--- a/src/archive/iso_plugin.c
+++ b/src/archive/iso_plugin.c
@@ -133,7 +133,8 @@ iso_close(struct archive_file *file)
}
//close archive
iso9660_close(context->iso);
- context->iso = NULL;
+
+ g_free(context);
}
/* single archive handling */
@@ -166,6 +167,8 @@ iso_is_close(struct input_stream *is)
{
iso_context *context = (iso_context *) is->data;
g_free(context->statbuf);
+
+ iso_close((struct archive_file *)context);
}
diff --git a/src/archive/zip_plugin.c b/src/archive/zip_plugin.c
index 9078c2d3..95bc1d02 100644
--- a/src/archive/zip_plugin.c
+++ b/src/archive/zip_plugin.c
@@ -100,7 +100,8 @@ zip_close(struct archive_file *file)
}
//close archive
zzip_dir_close (context->dir);
- context->dir = NULL;
+
+ g_free(context);
}
/* single archive handling */
@@ -134,6 +135,8 @@ zip_is_close(struct input_stream *is)
{
zip_context *context = (zip_context *) is->data;
zzip_file_close (context->file);
+
+ zip_close((struct archive_file *)context);
}
static size_t
diff --git a/src/archive_plugin.h b/src/archive_plugin.h
index 92310f01..df2dcff4 100644
--- a/src/archive_plugin.h
+++ b/src/archive_plugin.h
@@ -65,6 +65,9 @@ struct archive_plugin {
/**
* Opens an input_stream of a file within the archive.
*
+ * If this function succeeds, then the #input_stream "owns"
+ * the archive file and will automatically close it.
+ *
* @param path the path within the archive
*/
bool (*open_stream)(struct archive_file *, struct input_stream *is,
diff --git a/src/input/archive_input_plugin.c b/src/input/archive_input_plugin.c
index a98bd9e2..0de715a8 100644
--- a/src/input/archive_input_plugin.c
+++ b/src/input/archive_input_plugin.c
@@ -67,6 +67,7 @@ input_archive_open(struct input_stream *is, const char *pathname)
if (!opened) {
g_warning("open inarchive file %s failed\n\n",filename);
+ arplug->close(file);
} else {
is->ready = true;
}