From 73378197a4298f9a427766ee739667e4a534b301 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 21 Dec 2009 20:58:13 +0100 Subject: fixed sse2 unaligned memory access error in ape plugin --- plugins/ffap/ffap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/ffap') 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 #include #include +#include #include #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; -- cgit v1.2.3