aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-09-05 20:25:48 +0200
committerJanne Grunau <janne-libav@jannau.net>2012-09-06 19:02:43 +0200
commit59383d574046616ede75e51eeb404c9eb8b56d40 (patch)
treeaa33d0c703c14c8583a73b668644e86142530c3a /libavcodec
parenta224b2cb30759264147abda4aeb59de21966265c (diff)
downloadffmpeg-59383d574046616ede75e51eeb404c9eb8b56d40.tar.gz
mpegvideo: set AVFrame fields to NULL after freeing the base memory
Prevents dangling pointers and makes access after free more obvious. Setting AVFrame.qscale_table to NULL is required for successfully allocating a previously freed Picture with ff_alloc_picture().
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 718df8b63f..f51184f9f6 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -393,13 +393,16 @@ static void free_picture(MpegEncContext *s, Picture *pic)
av_freep(&pic->mb_mean);
av_freep(&pic->f.mbskip_table);
av_freep(&pic->qscale_table_base);
+ pic->f.qscale_table = NULL;
av_freep(&pic->mb_type_base);
+ pic->f.mb_type = NULL;
av_freep(&pic->f.dct_coeff);
av_freep(&pic->f.pan_scan);
pic->f.mb_type = NULL;
for (i = 0; i < 2; i++) {
av_freep(&pic->motion_val_base[i]);
av_freep(&pic->f.ref_index[i]);
+ pic->f.motion_val[i] = NULL;
}
if (pic->f.type == FF_BUFFER_TYPE_SHARED) {