mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/iirfilter: Change ff_iir_filter_free_coeffs() so it clears the pointers as well
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
9946da4976
commit
43fb16cf74
|
@ -196,7 +196,7 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc,
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
init_fail:
|
init_fail:
|
||||||
ff_iir_filter_free_coeffs(c);
|
ff_iir_filter_free_coeffsp(&c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,13 +304,14 @@ av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *state)
|
||||||
av_free(state);
|
av_free(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
|
av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
|
||||||
{
|
{
|
||||||
|
struct FFIIRFilterCoeffs *coeffs = *coeffsp;
|
||||||
if(coeffs){
|
if(coeffs){
|
||||||
av_free(coeffs->cx);
|
av_freep(&coeffs->cx);
|
||||||
av_free(coeffs->cy);
|
av_freep(&coeffs->cy);
|
||||||
}
|
}
|
||||||
av_free(coeffs);
|
av_freep(coeffsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_iir_filter_init(FFIIRFilterContext *f) {
|
void ff_iir_filter_init(FFIIRFilterContext *f) {
|
||||||
|
@ -347,7 +348,7 @@ int main(void)
|
||||||
for (i = 0; i < SIZE; i++)
|
for (i = 0; i < SIZE; i++)
|
||||||
printf("%6d %6d\n", x[i], y[i]);
|
printf("%6d %6d\n", x[i], y[i]);
|
||||||
|
|
||||||
ff_iir_filter_free_coeffs(fcoeffs);
|
ff_iir_filter_free_coeffsp(&fcoeffs);
|
||||||
ff_iir_filter_free_state(fstate);
|
ff_iir_filter_free_state(fstate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct FFIIRFilterState* ff_iir_filter_init_state(int order);
|
||||||
*
|
*
|
||||||
* @param coeffs pointer allocated with ff_iir_filter_init_coeffs()
|
* @param coeffs pointer allocated with ff_iir_filter_init_coeffs()
|
||||||
*/
|
*/
|
||||||
void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs);
|
void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free filter state.
|
* Free filter state.
|
||||||
|
|
|
@ -138,7 +138,7 @@ void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int ch
|
||||||
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
|
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ff_iir_filter_free_coeffs(ctx->fcoeffs);
|
ff_iir_filter_free_coeffsp(&ctx->fcoeffs);
|
||||||
if (ctx->fstate)
|
if (ctx->fstate)
|
||||||
for (i = 0; i < ctx->avctx->channels; i++)
|
for (i = 0; i < ctx->avctx->channels; i++)
|
||||||
ff_iir_filter_free_state(ctx->fstate[i]);
|
ff_iir_filter_free_state(ctx->fstate[i]);
|
||||||
|
|
Loading…
Reference in New Issue