summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorZdenek Kabelac <kabi@informatics.muni.cz>2002-12-03 19:40:35 +0000
committerZdenek Kabelac <kabi@informatics.muni.cz>2002-12-03 19:40:35 +0000
commit855ea723b0ea450137e54674179751c14e8fc6b5 (patch)
treee8c81d27ce40b9c8f4f064cf06b464e26fed4d09 /libavcodec/mpegaudiodec.c
parent17308326396778cd31451ef7a69c36c7ccb7cab7 (diff)
* two functions to handle allocation of static data more simple
av_mallocz_static - called for every static data table av_free_static - called when ffmpeg is no longer needed and should free all static resources * simple usage shown in mpegaudiodec.c Originally committed as revision 1301 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index a119b481d5..b2c0966aa0 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -379,17 +379,13 @@ static int decode_init(AVCodecContext * avctx)
band_index_long[i][22] = k;
}
- /* compute n ^ (4/3) and store it in mantissa/exp format */
- table_4_3_exp = av_mallocz(TABLE_4_3_SIZE *
- sizeof(table_4_3_exp[0]));
- if (!table_4_3_exp)
+ /* compute n ^ (4/3) and store it in mantissa/exp format */
+ if (!av_mallocz_static(&table_4_3_exp,
+ TABLE_4_3_SIZE * sizeof(table_4_3_exp[0])))
+ return -1;
+ if (!av_mallocz_static(&table_4_3_value,
+ TABLE_4_3_SIZE * sizeof(table_4_3_value[0])))
return -1;
- table_4_3_value = av_mallocz(TABLE_4_3_SIZE *
- sizeof(table_4_3_value[0]));
- if (!table_4_3_value) {
- av_free(table_4_3_exp);
- return -1;
- }
int_pow_init();
for(i=1;i<TABLE_4_3_SIZE;i++) {