summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libfaad/decoder.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/decoder.c
parent78b0f94c76e7d176bf24ab2c9a49f67b32537cc2 (diff)
downloadrockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.gz
rockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.bz2
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/decoder.c')
-rw-r--r--apps/codecs/libfaad/decoder.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/codecs/libfaad/decoder.c b/apps/codecs/libfaad/decoder.c
index 05d788597e..caedda7f55 100644
--- a/apps/codecs/libfaad/decoder.c
+++ b/apps/codecs/libfaad/decoder.c
@@ -346,6 +346,11 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
hDecoder->time_out[i] = s_time_buf_2048[i];
#else
hDecoder->time_out[i] = (real_t*)faad_malloc(2*FRAME_LEN*sizeof(real_t));
+ if (hDecoder->time_out[i] == NULL)
+ {
+ /* could not allocate memory */
+ return -1;
+ }
#endif
memset(hDecoder->time_out[i], 0, 2*FRAME_LEN);
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
@@ -469,6 +474,11 @@ int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
hDecoder->time_out[i] = s_time_buf_2048[i];
#else
hDecoder->time_out[i] = (real_t*)faad_malloc(2*FRAME_LEN*sizeof(real_t));
+ if (hDecoder->time_out[i] == NULL)
+ {
+ /* could not allocate memory */
+ return -1;
+ }
#endif
memset(hDecoder->time_out[i], 0, 2*FRAME_LEN);
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;