From 3411f6cffdcf3c72e7cee3a263c40414dfef956e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Dec 2009 19:45:50 +0100 Subject: archive: close archive when stream is closed Fixes a memory leak: the "archive" input plugin opens the archive, but never closes it. This patch moves the responsibility for doing that to archive_plugin.open_stream(). This is an slight internal API change, but it is the simplest and least intrusive fix for the memory leak. --- src/archive/zip_plugin.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/archive/zip_plugin.c') diff --git a/src/archive/zip_plugin.c b/src/archive/zip_plugin.c index dbd2534fa..2f08b3812 100644 --- a/src/archive/zip_plugin.c +++ b/src/archive/zip_plugin.c @@ -133,6 +133,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 -- cgit v1.2.3 From 9179f108a540dcd27dafeb015778cc4dd873dfe5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Dec 2009 19:56:38 +0100 Subject: iso, zip: fixed memory leak in destructor Free the "context" pointer in the method archive_plugin.close(). --- src/archive/zip_plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/archive/zip_plugin.c') diff --git a/src/archive/zip_plugin.c b/src/archive/zip_plugin.c index 2f08b3812..243d46418 100644 --- a/src/archive/zip_plugin.c +++ b/src/archive/zip_plugin.c @@ -99,7 +99,8 @@ zip_close(struct archive_file *file) } //close archive zzip_dir_close (context->dir); - context->dir = NULL; + + g_free(context); } /* single archive handling */ -- cgit v1.2.3