summaryrefslogtreecommitdiff
path: root/apps/codecs/libfaad/sbr_dec.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-10 19:04:24 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-10 19:04:24 +0000
commit03e23d111385161afc917abe21b19cf8761e0440 (patch)
tree8c0b71ce052e9f410ee08bb80f932363b3d5d45c /apps/codecs/libfaad/sbr_dec.c
parent78b0f94c76e7d176bf24ab2c9a49f67b32537cc2 (diff)
downloadrockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.gz
rockbox-03e23d111385161afc917abe21b19cf8761e0440.zip
Implement error handling for libfaad's memory allocation. Do not allocate PS related types dynamically anymore to minimize code changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29854 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libfaad/sbr_dec.c')
-rw-r--r--apps/codecs/libfaad/sbr_dec.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/apps/codecs/libfaad/sbr_dec.c b/apps/codecs/libfaad/sbr_dec.c
index 7f6a9bbffe..678ebfe520 100644
--- a/apps/codecs/libfaad/sbr_dec.c
+++ b/apps/codecs/libfaad/sbr_dec.c
@@ -73,20 +73,25 @@ static void sbr_save_matrix(sbr_info *sbr, uint8_t ch);
73 73
74 74
75sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint8_t id_ele, 75sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint8_t id_ele,
76 uint32_t sample_rate, uint8_t downSampledSBR 76 uint32_t sample_rate, uint8_t downSampledSBR,
77#ifdef DRM 77 uint8_t IsDRM)
78 , uint8_t IsDRM
79#endif
80 )
81{ 78{
82 (void)downSampledSBR; 79 (void)downSampledSBR;
80#ifndef DRM
81 (void)IsDRM;
82#endif
83 83
84 /* Allocate sbr_info. */ 84 /* Allocate sbr_info. */
85#if defined(FAAD_STATIC_ALLOC) 85#if defined(FAAD_STATIC_ALLOC)
86 sbr_info *sbr = &s_sbr[id_ele]; 86 sbr_info *sbr = &s_sbr[id_ele];
87#else 87#else
88 (void)id_ele; 88 (void)id_ele;
89 sbr_info *sbr =(sbr_info*)faad_malloc(sizeof(sbr_info)); 89 sbr_info *sbr = (sbr_info*)faad_malloc(sizeof(sbr_info));
90 if (sbr == NULL)
91 {
92 /* could not allocate memory */
93 return NULL;
94 }
90#endif 95#endif
91 memset(sbr, 0, sizeof(sbr_info)); 96 memset(sbr, 0, sizeof(sbr_info));
92 97
@@ -95,7 +100,12 @@ sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint8_t id_ele,
95#if defined(FAAD_STATIC_ALLOC) || defined(FAAD_HAVE_XLR_IN_IRAM) 100#if defined(FAAD_STATIC_ALLOC) || defined(FAAD_HAVE_XLR_IN_IRAM)
96 p_XLR = &s_XLR; 101 p_XLR = &s_XLR;
97#else 102#else
98 p_XLR =(XLR_t*)faad_malloc(sizeof(XLR_t)); 103 p_XLR = (XLR_t*)faad_malloc(sizeof(XLR_t));
104 if (p_XLR == NULL)
105 {
106 /* could not allocate memory */
107 return NULL;
108 }
99#endif 109#endif
100 memset(p_XLR, 0, sizeof(XLR_t)); 110 memset(p_XLR, 0, sizeof(XLR_t));
101 111