summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChiwen Chang <rock1104.tw@yahoo.com.tw>2015-01-28 17:30:54 +1100
committerGerrit Rockbox <gerrit@rockbox.org>2015-01-30 20:06:00 +0100
commit572b36a51a7796e88c11cf0658ced40c1a6efece (patch)
tree90ab2f663635770b2a4e6d69c9e1dcc266ba950a
parentf35d63bc216e59ba1eecfb138e23915521716128 (diff)
downloadrockbox-572b36a51a7796e88c11cf0658ced40c1a6efece.tar.gz
rockbox-572b36a51a7796e88c11cf0658ced40c1a6efece.zip
fix surround & pbe dsp crash
check handle before clean up buffer in flush(). Change-Id: I36a130c45c9f5dce97aa723ef98922b6935ead75
-rw-r--r--lib/rbcodec/dsp/pbe.c3
-rw-r--r--lib/rbcodec/dsp/surround.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/rbcodec/dsp/pbe.c b/lib/rbcodec/dsp/pbe.c
index 28cdbb2084..3656f687fd 100644
--- a/lib/rbcodec/dsp/pbe.c
+++ b/lib/rbcodec/dsp/pbe.c
@@ -80,7 +80,8 @@ static void dsp_pbe_flush(void)
80 return; /* Not currently enabled */ 80 return; /* Not currently enabled */
81 81
82 unsigned int total_len = (B0_SIZE + B2_SIZE + B3_SIZE) * 2; 82 unsigned int total_len = (B0_SIZE + B2_SIZE + B3_SIZE) * 2;
83 memset(core_get_data(handle),0,sizeof(int32_t) * total_len); 83 if (handle > 0)
84 memset(core_get_data(handle),0,sizeof(int32_t) * total_len);
84 b0_r[0] = 0; b0_w[0] = 0; 85 b0_r[0] = 0; b0_w[0] = 0;
85 b0_r[1] = 0; b0_w[1] = 0; 86 b0_r[1] = 0; b0_w[1] = 0;
86 b2_r[0] = 0; b2_w[0] = 0; 87 b2_r[0] = 0; b2_w[0] = 0;
diff --git a/lib/rbcodec/dsp/surround.c b/lib/rbcodec/dsp/surround.c
index 26d12b1952..b2995de49f 100644
--- a/lib/rbcodec/dsp/surround.c
+++ b/lib/rbcodec/dsp/surround.c
@@ -97,7 +97,8 @@ static void dsp_surround_flush(void)
97 return; 97 return;
98 98
99 unsigned int total_len = B0_DLY + B2_DLY + BB_DLY + HH_DLY + CL_DLY; 99 unsigned int total_len = B0_DLY + B2_DLY + BB_DLY + HH_DLY + CL_DLY;
100 memset(core_get_data(handle),0,sizeof(int32_t) * total_len); 100 if (handle > 0)
101 memset(core_get_data(handle),0,sizeof(int32_t) * total_len);
101} 102}
102 103
103static void surround_update_filter(unsigned int fout) 104static void surround_update_filter(unsigned int fout)