aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-18 09:57:53 +0100
committerMax Kellermann <max@duempel.org>2010-01-18 09:57:53 +0100
commitfb9bd53328e3ff57ea4b3cfee24068f9fb54927b (patch)
treee350fdb14ebf8916897797c59527f25d703d3883
parenta0a26d3341022552984a3307393a8f701f350edc (diff)
downloadmpd-fb9bd53328e3ff57ea4b3cfee24068f9fb54927b.tar.gz
mpd-fb9bd53328e3ff57ea4b3cfee24068f9fb54927b.tar.xz
mpd-fb9bd53328e3ff57ea4b3cfee24068f9fb54927b.zip
input_stream: added function input_stream_deinit()
All close() implementations must call this method.
Diffstat (limited to '')
-rw-r--r--src/archive/bz2_archive_plugin.c2
-rw-r--r--src/archive/iso9660_archive_plugin.c3
-rw-r--r--src/archive/zzip_archive_plugin.c1
-rw-r--r--src/input/curl_input_plugin.c1
-rw-r--r--src/input/file_input_plugin.c1
-rw-r--r--src/input/mms_input_plugin.c1
-rw-r--r--src/input/rewind_input_plugin.c1
-rw-r--r--src/input_stream.c2
-rw-r--r--src/input_stream.h6
9 files changed, 16 insertions, 2 deletions
diff --git a/src/archive/bz2_archive_plugin.c b/src/archive/bz2_archive_plugin.c
index 75b4b1ece..67cc0055c 100644
--- a/src/archive/bz2_archive_plugin.c
+++ b/src/archive/bz2_archive_plugin.c
@@ -182,6 +182,7 @@ bz2_open_stream(struct archive_file *file,
bis->base.seekable = false;
if (!bz2_alloc(bis, error_r)) {
+ input_stream_deinit(&bis->base);
g_free(bis);
return NULL;
}
@@ -202,6 +203,7 @@ bz2_is_close(struct input_stream *is)
bz2_close(&bis->archive->base);
+ input_stream_deinit(&bis->base);
g_free(bis);
}
diff --git a/src/archive/iso9660_archive_plugin.c b/src/archive/iso9660_archive_plugin.c
index 38003da94..30f8e7f52 100644
--- a/src/archive/iso9660_archive_plugin.c
+++ b/src/archive/iso9660_archive_plugin.c
@@ -212,6 +212,9 @@ iso9660_input_close(struct input_stream *is)
g_free(iis->statbuf);
iso9660_archive_close(&iis->archive->base);
+
+ input_stream_deinit(&iis->base);
+ g_free(iis);
}
diff --git a/src/archive/zzip_archive_plugin.c b/src/archive/zzip_archive_plugin.c
index 7e59a0935..fdf6b677c 100644
--- a/src/archive/zzip_archive_plugin.c
+++ b/src/archive/zzip_archive_plugin.c
@@ -171,6 +171,7 @@ zzip_input_close(struct input_stream *is)
zzip_file_close(zis->file);
zzip_archive_close(&zis->archive->base);
+ input_stream_deinit(&zis->base);
g_free(zis);
}
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index c54d994e8..1b759b4fc 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -195,6 +195,7 @@ input_curl_free(struct input_curl *c)
g_queue_free(c->buffers);
g_free(c->url);
+ input_stream_deinit(&c->base);
g_free(c);
}
diff --git a/src/input/file_input_plugin.c b/src/input/file_input_plugin.c
index 1c5813f88..173b7c2e8 100644
--- a/src/input/file_input_plugin.c
+++ b/src/input/file_input_plugin.c
@@ -136,6 +136,7 @@ input_file_close(struct input_stream *is)
struct file_input_stream *fis = (struct file_input_stream *)is;
close(fis->fd);
+ input_stream_deinit(&fis->base);
g_free(fis);
}
diff --git a/src/input/mms_input_plugin.c b/src/input/mms_input_plugin.c
index 5055eb05e..31a75fdba 100644
--- a/src/input/mms_input_plugin.c
+++ b/src/input/mms_input_plugin.c
@@ -103,6 +103,7 @@ input_mms_close(struct input_stream *is)
struct input_mms *m = (struct input_mms *)is;
mmsx_close(m->mms);
+ input_stream_deinit(&m->base);
g_free(m);
}
diff --git a/src/input/rewind_input_plugin.c b/src/input/rewind_input_plugin.c
index 2804dd1b2..e82d4ecb9 100644
--- a/src/input/rewind_input_plugin.c
+++ b/src/input/rewind_input_plugin.c
@@ -98,6 +98,7 @@ input_rewind_close(struct input_stream *is)
input_stream_close(r->input);
+ input_stream_deinit(&r->base);
g_free(r);
}
diff --git a/src/input_stream.c b/src/input_stream.c
index 96c692176..e769adb92 100644
--- a/src/input_stream.c
+++ b/src/input_stream.c
@@ -99,8 +99,6 @@ input_stream_read(struct input_stream *is, void *ptr, size_t size,
void input_stream_close(struct input_stream *is)
{
- g_free(is->mime);
-
is->plugin->close(is);
}
diff --git a/src/input_stream.h b/src/input_stream.h
index e48f7eb26..05ef257f9 100644
--- a/src/input_stream.h
+++ b/src/input_stream.h
@@ -76,6 +76,12 @@ input_stream_init(struct input_stream *is, const struct input_plugin *plugin)
is->mime = NULL;
}
+static inline void
+input_stream_deinit(struct input_stream *is)
+{
+ g_free(is->mime);
+}
+
/**
* Opens a new input stream. You may not access it until the "ready"
* flag is set.