[FFmpeg-cvslog] avcodec/snow: clear freed pointers

Michael Niedermayer git at videolan.org
Mon Nov 17 00:02:53 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 16 23:34:40 2014 +0100| [7ababb85f963c3354fb10000742c6857bb1198ed] | committer: Michael Niedermayer

avcodec/snow: clear freed pointers

Avoid leaving stale pointers in memory

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

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

 libavcodec/snow.c    |    4 +++-
 libavcodec/snowenc.c |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 3701707..83db3c7 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -637,8 +637,10 @@ void ff_snow_release_buffer(AVCodecContext *avctx)
     if(s->last_picture[s->max_ref_frames-1]->data[0]){
         av_frame_unref(s->last_picture[s->max_ref_frames-1]);
         for(i=0; i<9; i++)
-            if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3])
+            if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3]) {
                 av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture->linesize[i%3]));
+                s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] = NULL;
+            }
     }
 }
 
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index c790d9b..cbc89c9 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1862,7 +1862,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
     ff_snow_common_end(s);
     ff_rate_control_uninit(&s->m);
     av_frame_free(&s->input_picture);
-    av_free(avctx->stats_out);
+    av_freep(&avctx->stats_out);
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list