Browse Source

avcodec/iirfilter: Make ff_iir_filter_free_state() also zero the freed pointer

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.5
Michael Niedermayer 11 years ago
parent
commit
f43ac02723
3 changed files with 7 additions and 7 deletions
  1. +3
    -3
      libavcodec/iirfilter.c
  2. +3
    -3
      libavcodec/iirfilter.h
  3. +1
    -1
      libavcodec/psymodel.c

+ 3
- 3
libavcodec/iirfilter.c View File

@@ -299,9 +299,9 @@ void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c,
}
}

av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *state)
av_cold void ff_iir_filter_free_statep(struct FFIIRFilterState **state)
{
av_free(state);
av_freep(state);
}

av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
@@ -349,7 +349,7 @@ int main(void)
printf("%6d %6d\n", x[i], y[i]);

ff_iir_filter_free_coeffsp(&fcoeffs);
ff_iir_filter_free_state(fstate);
ff_iir_filter_free_statep(&fstate);
return 0;
}
#endif /* TEST */

+ 3
- 3
libavcodec/iirfilter.h View File

@@ -107,11 +107,11 @@ struct FFIIRFilterState* ff_iir_filter_init_state(int order);
void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs);

/**
* Free filter state.
* Free and zero filter state.
*
* @param state pointer allocated with ff_iir_filter_init_state()
* @param state pointer to pointer allocated with ff_iir_filter_init_state()
*/
void ff_iir_filter_free_state(struct FFIIRFilterState *state);
void ff_iir_filter_free_statep(struct FFIIRFilterState **state);

/**
* Perform IIR filtering on signed 16-bit input samples.


+ 1
- 1
libavcodec/psymodel.c View File

@@ -141,7 +141,7 @@ av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
ff_iir_filter_free_coeffsp(&ctx->fcoeffs);
if (ctx->fstate)
for (i = 0; i < ctx->avctx->channels; i++)
ff_iir_filter_free_state(ctx->fstate[i]);
ff_iir_filter_free_statep(&ctx->fstate[i]);
av_freep(&ctx->fstate);
av_free(ctx);
}

Loading…
Cancel
Save