[FFmpeg-cvslog] avcodec/iirfilter: Make ff_iir_filter_free_state() also zero the freed pointer

Michael Niedermayer git at videolan.org
Tue Oct 14 21:51:06 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct 14 18:52:51 2014 +0200| [f43ac027232f6aeb826d7c29b1dfca9b3876f3ed] | committer: Michael Niedermayer

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

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f43ac027232f6aeb826d7c29b1dfca9b3876f3ed
---

 libavcodec/iirfilter.c |    6 +++---
 libavcodec/iirfilter.h |    6 +++---
 libavcodec/psymodel.c  |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index b47f91d..cb5871c 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -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 */
diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h
index cc9a661..6f7bba6 100644
--- a/libavcodec/iirfilter.h
+++ b/libavcodec/iirfilter.h
@@ -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.
diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
index e7f3353..059cbef 100644
--- a/libavcodec/psymodel.c
+++ b/libavcodec/psymodel.c
@@ -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);
 }



More information about the ffmpeg-cvslog mailing list