Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2014/10/15 01:30:52... | ... |
@@ -196,7 +196,7 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, |
196 | 196 |
return c; |
197 | 197 |
|
198 | 198 |
init_fail: |
199 |
- ff_iir_filter_free_coeffs(c); |
|
199 |
+ ff_iir_filter_free_coeffsp(&c); |
|
200 | 200 |
return NULL; |
201 | 201 |
} |
202 | 202 |
|
... | ... |
@@ -304,13 +304,14 @@ av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *state) |
304 | 304 |
av_free(state); |
305 | 305 |
} |
306 | 306 |
|
307 |
-av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs) |
|
307 |
+av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp) |
|
308 | 308 |
{ |
309 |
+ struct FFIIRFilterCoeffs *coeffs = *coeffsp; |
|
309 | 310 |
if(coeffs){ |
310 |
- av_free(coeffs->cx); |
|
311 |
- av_free(coeffs->cy); |
|
311 |
+ av_freep(&coeffs->cx); |
|
312 |
+ av_freep(&coeffs->cy); |
|
312 | 313 |
} |
313 |
- av_free(coeffs); |
|
314 |
+ av_freep(coeffsp); |
|
314 | 315 |
} |
315 | 316 |
|
316 | 317 |
void ff_iir_filter_init(FFIIRFilterContext *f) { |
... | ... |
@@ -347,7 +348,7 @@ int main(void) |
347 | 347 |
for (i = 0; i < SIZE; i++) |
348 | 348 |
printf("%6d %6d\n", x[i], y[i]); |
349 | 349 |
|
350 |
- ff_iir_filter_free_coeffs(fcoeffs); |
|
350 |
+ ff_iir_filter_free_coeffsp(&fcoeffs); |
|
351 | 351 |
ff_iir_filter_free_state(fstate); |
352 | 352 |
return 0; |
353 | 353 |
} |
... | ... |
@@ -104,7 +104,7 @@ struct FFIIRFilterState* ff_iir_filter_init_state(int order); |
104 | 104 |
* |
105 | 105 |
* @param coeffs pointer allocated with ff_iir_filter_init_coeffs() |
106 | 106 |
*/ |
107 |
-void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs); |
|
107 |
+void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs); |
|
108 | 108 |
|
109 | 109 |
/** |
110 | 110 |
* Free filter state. |
... | ... |
@@ -138,7 +138,7 @@ void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int ch |
138 | 138 |
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx) |
139 | 139 |
{ |
140 | 140 |
int i; |
141 |
- ff_iir_filter_free_coeffs(ctx->fcoeffs); |
|
141 |
+ ff_iir_filter_free_coeffsp(&ctx->fcoeffs); |
|
142 | 142 |
if (ctx->fstate) |
143 | 143 |
for (i = 0; i < ctx->avctx->channels; i++) |
144 | 144 |
ff_iir_filter_free_state(ctx->fstate[i]); |