diff mbox series

[FFmpeg-devel,30/40] avcodec/cngenc: Replace av_free() by av_freep() in close function

Message ID 20200914052747.124118-14-andreas.rheinhardt@gmail.com
State Accepted
Commit 29c5c8fdfb4f7c3fe22260d73e9ade7e54330a7d
Headers show
Series [FFmpeg-devel,01/16] avcodec/snowdec: Use ff_snow_common_init() directly
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 14, 2020, 5:27 a.m. UTC
This avoids leaving pointers to already freed memory in memory.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/cngenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c
index e185c4a40a..8f23b7555a 100644
--- a/libavcodec/cngenc.c
+++ b/libavcodec/cngenc.c
@@ -37,8 +37,8 @@  static av_cold int cng_encode_close(AVCodecContext *avctx)
 {
     CNGContext *p = avctx->priv_data;
     ff_lpc_end(&p->lpc);
-    av_free(p->samples32);
-    av_free(p->ref_coef);
+    av_freep(&p->samples32);
+    av_freep(&p->ref_coef);
     return 0;
 }