diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-10 19:04:24 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-10 19:04:24 +0000 |
| commit | 03e23d111385161afc917abe21b19cf8761e0440 (patch) | |
| tree | 8c0b71ce052e9f410ee08bb80f932363b3d5d45c /apps/codecs/libfaad/syntax.c | |
| parent | 78b0f94c76e7d176bf24ab2c9a49f67b32537cc2 (diff) | |
| download | rockbox-03e23d111385161afc917abe21b19cf8761e0440.zip rockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.gz rockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.bz2 rockbox-03e23d111385161afc917abe21b19cf8761e0440.tar.xz | |
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/syntax.c')
| -rw-r--r-- | apps/codecs/libfaad/syntax.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/apps/codecs/libfaad/syntax.c b/apps/codecs/libfaad/syntax.c index 4c7baab..af1a50f 100644 --- a/apps/codecs/libfaad/syntax.c +++ b/apps/codecs/libfaad/syntax.c @@ -1031,11 +1031,14 @@ static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[sbr_ele], sbr_ele, 2*get_sample_rate(hDecoder->sf_index), - hDecoder->downSampledSBR -#ifdef DRM - , 0 + hDecoder->downSampledSBR, 0); +#ifndef FAAD_STATIC_ALLOC + if (hDecoder->sbr[sbr_ele] == NULL) + { + /* could not allocate memory */ + return 28; + } #endif - ); } hDecoder->sbr_present_flag = 1; @@ -1249,10 +1252,24 @@ void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo { hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0], 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1); +#ifndef FAAD_STATIC_ALLOC + if (hDecoder->sbr[0] == NULL) + { + /* could not allocate memory */ + hInfo->error = 28; + return; + } +#endif } /* Reverse bit reading of SBR data in DRM audio frame */ revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); + if (revbuffer == NULL) + { + /* could not allocate memory */ + hInfo->error = 28; + return; + } prevbufstart = revbuffer; pbufend = &buffer[buffer_size - 1]; for (i = 0; i < buffer_size; i++) |