aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-15 20:24:15 +0200
committerMax Kellermann <max@duempel.org>2011-09-15 20:24:15 +0200
commit48a84ca23ef40b87056214ea03b5f141a4ed54c4 (patch)
tree579e5133640c02acb3e62ef48e617065728458fb /src/input
parentc345c5ebae24086093252afc50ea15e4f0f21386 (diff)
downloadmpd-48a84ca23ef40b87056214ea03b5f141a4ed54c4.tar.gz
mpd-48a84ca23ef40b87056214ea03b5f141a4ed54c4.tar.xz
mpd-48a84ca23ef40b87056214ea03b5f141a4ed54c4.zip
input/rewind: copy the MIME type only once
Reduce heap usage by reducing the number of malloc() / free() calls.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/rewind_input_plugin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/input/rewind_input_plugin.c b/src/input/rewind_input_plugin.c
index 6325a978e..f0d533bc8 100644
--- a/src/input/rewind_input_plugin.c
+++ b/src/input/rewind_input_plugin.c
@@ -83,12 +83,14 @@ copy_attributes(struct input_rewind *r)
assert(dest != src);
assert(src->mime == NULL || dest->mime != src->mime);
+ bool dest_ready = dest->ready;
+
dest->ready = src->ready;
dest->seekable = src->seekable;
dest->size = src->size;
dest->offset = src->offset;
- if (src->mime != NULL) {
+ if (!dest_ready && src->ready) {
g_free(dest->mime);
dest->mime = g_strdup(src->mime);
}