comparison avfft.c @ 12151:fb37ee915b73 libavcodec

avfft: make init functions return NULL on failure as intended
author mru
date Mon, 12 Jul 2010 19:54:16 +0000
parents f468aac92300
children 65462b406d6b
comparison
equal deleted inserted replaced
12150:30867f2c9009 12151:fb37ee915b73
26 { 26 {
27 FFTContext *s = av_malloc(sizeof(*s)); 27 FFTContext *s = av_malloc(sizeof(*s));
28 28
29 if (s) 29 if (s)
30 ff_fft_init(s, nbits, inverse); 30 ff_fft_init(s, nbits, inverse);
31 else
32 av_freep(&s);
31 33
32 return s; 34 return s;
33 } 35 }
34 36
35 void av_fft_permute(FFTContext *s, FFTComplex *z) 37 void av_fft_permute(FFTContext *s, FFTComplex *z)
56 { 58 {
57 FFTContext *s = av_malloc(sizeof(*s)); 59 FFTContext *s = av_malloc(sizeof(*s));
58 60
59 if (s) 61 if (s)
60 ff_mdct_init(s, nbits, inverse, scale); 62 ff_mdct_init(s, nbits, inverse, scale);
63 else
64 av_freep(&s);
61 65
62 return s; 66 return s;
63 } 67 }
64 68
65 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) 69 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
93 { 97 {
94 RDFTContext *s = av_malloc(sizeof(*s)); 98 RDFTContext *s = av_malloc(sizeof(*s));
95 99
96 if (s) 100 if (s)
97 ff_rdft_init(s, nbits, trans); 101 ff_rdft_init(s, nbits, trans);
102 else
103 av_freep(&s);
98 104
99 return s; 105 return s;
100 } 106 }
101 107
102 void av_rdft_calc(RDFTContext *s, FFTSample *data) 108 void av_rdft_calc(RDFTContext *s, FFTSample *data)
120 { 126 {
121 DCTContext *s = av_malloc(sizeof(*s)); 127 DCTContext *s = av_malloc(sizeof(*s));
122 128
123 if (s) 129 if (s)
124 ff_dct_init(s, nbits, inverse); 130 ff_dct_init(s, nbits, inverse);
131 else
132 av_freep(&s);
125 133
126 return s; 134 return s;
127 } 135 }
128 136
129 void av_dct_calc(DCTContext *s, FFTSample *data) 137 void av_dct_calc(DCTContext *s, FFTSample *data)