summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-11-12 19:13:13 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-11-12 19:13:13 +0100
commita7c7783db09cbfcbd51580e199aab6a90d812a81 (patch)
treea0f3692da13a38f10b1b9e6b84a5331959453c0a /plugins
parent8c93bde7ec685a0124e518922a31c79d8b22ce17 (diff)
flac plugin allocates buffer only when used
Diffstat (limited to 'plugins')
-rw-r--r--plugins/flac/flac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 13862b3b..776e3e95 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -32,7 +32,7 @@ static DB_functions_t *deadbeef;
static FLAC__StreamDecoder *decoder = 0;
#define BUFFERSIZE 100000
-static char buffer[BUFFERSIZE]; // this buffer always has float samples
+static char *buffer; // this buffer always has float samples
static int remaining; // bytes remaining in buffer from last read
static int startsample;
static int endsample;
@@ -208,6 +208,7 @@ cflac_init (DB_playItem_t *it) {
}
remaining = 0;
+ buffer = malloc (BUFFERSIZE);
return 0;
}
@@ -217,6 +218,10 @@ cflac_free (void) {
FLAC__stream_decoder_delete(decoder);
decoder = NULL;
}
+ if (buffer) {
+ free (buffer);
+ buffer = NULL;
+ }
}
static int