From 6aeb5ff8e1bdfcfe5675ab49c48ea52569dcddb1 Mon Sep 17 00:00:00 2001
From: Markus Henschel <markus.henschel@yager.de>
Date: Mon, 4 Nov 2013 15:56:51 +0100
Subject: [PATCH] remove unnecessary reallocation of the channel matrix

---
 addons/audio/kcm_mixer.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/addons/audio/kcm_mixer.c b/addons/audio/kcm_mixer.c
index 10c40a6..76de4ee 100644
--- a/addons/audio/kcm_mixer.c
+++ b/addons/audio/kcm_mixer.c
@@ -145,17 +145,14 @@ void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer,
    size_t src_chans;
    size_t i, j;
 
-   if (spl->matrix) {
-      al_free(spl->matrix);
-   }
-
    mat = _al_rechannel_matrix(spl->spl_data.chan_conf,
       mixer->ss.spl_data.chan_conf, spl->gain, spl->pan);
 
    dst_chans = al_get_channel_count(mixer->ss.spl_data.chan_conf);
    src_chans = al_get_channel_count(spl->spl_data.chan_conf);
 
-   spl->matrix = al_calloc(1, src_chans * dst_chans * sizeof(float));
+   if (!spl->matrix)
+      spl->matrix = al_calloc(1, src_chans * dst_chans * sizeof(float));
 
    for (i = 0; i < dst_chans; i++) {
       for (j = 0; j < src_chans; j++) {
-- 
1.8.3.msysgit.0

