diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-14 18:30:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-14 18:30:52 +0200 |
commit | 43fb16cf74718fe6c393c5f20d0bfaea4e3e8cb4 (patch) | |
tree | e2802a6f4f117a2a117720bfbd7e2542efd399bb /libavcodec/iirfilter.c | |
parent | 9946da49766384dd6e25585160da0b454d4a5cbc (diff) | |
download | ffmpeg-43fb16cf74718fe6c393c5f20d0bfaea4e3e8cb4.tar.gz |
avcodec/iirfilter: Change ff_iir_filter_free_coeffs() so it clears the pointers as well
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/iirfilter.c')
-rw-r--r-- | libavcodec/iirfilter.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index a2d9d11250..b47f91d7b4 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -196,7 +196,7 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, return c; init_fail: - ff_iir_filter_free_coeffs(c); + ff_iir_filter_free_coeffsp(&c); return NULL; } @@ -304,13 +304,14 @@ av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *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){ - av_free(coeffs->cx); - av_free(coeffs->cy); + av_freep(&coeffs->cx); + av_freep(&coeffs->cy); } - av_free(coeffs); + av_freep(coeffsp); } void ff_iir_filter_init(FFIIRFilterContext *f) { @@ -347,7 +348,7 @@ int main(void) for (i = 0; i < SIZE; 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); return 0; } |