summaryrefslogtreecommitdiff
path: root/plugins/ffap
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-21 20:58:13 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-21 20:58:13 +0100
commit73378197a4298f9a427766ee739667e4a534b301 (patch)
tree1f2c0528975b460d24c48ab0fd6e6e8d06786cd0 /plugins/ffap
parent26e543f4f5f94805e2bab59e4518cd0398c86c46 (diff)
fixed sse2 unaligned memory access error in ape plugin
Diffstat (limited to 'plugins/ffap')
-rw-r--r--plugins/ffap/ffap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 0220bab1..184bba2b 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <limits.h>
#include <stdlib.h>
+#include <malloc.h>
#include <assert.h>
#include "../../deadbeef.h"
@@ -638,7 +639,7 @@ ape_free_ctx (APEContext *ape_ctx) {
ape_ctx->seektable = NULL;
}
for (i = 0; i < APE_FILTER_LEVELS; i++) {
- if (ape_ctx->filterbuf) {
+ if (ape_ctx->filterbuf[i]) {
free (ape_ctx->filterbuf[i]);
ape_ctx->filterbuf[i] = NULL;
}
@@ -699,7 +700,11 @@ ffap_init(DB_playItem_t *it)
for (i = 0; i < APE_FILTER_LEVELS; i++) {
if (!ape_filter_orders[ape_ctx.fset][i])
break;
- ape_ctx.filterbuf[i] = malloc((ape_filter_orders[ape_ctx.fset][i] * 3 + HISTORY_SIZE) * 4);
+ int err = posix_memalign ((void **)&ape_ctx.filterbuf[i], 16, (ape_filter_orders[ape_ctx.fset][i] * 3 + HISTORY_SIZE) * 4);
+ if (err) {
+ trace ("ffap: out of memory (posix_memalign)\n");
+ return -1;
+ }
}
plugin.info.bps = ape_ctx.bps;