[FFmpeg-cvslog] vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors

Martin Storsjö git at videolan.org
Mon Sep 23 13:41:48 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Sep 20 11:16:00 2013 +0300| [ede508443e4bf57dc1e019fac81bf6244b88fbd3] | committer: Martin Storsjö

vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavcodec/vc1dec.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 0feff21..35a0fe7 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5525,8 +5525,19 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 
     if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane ||
         !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base ||
-        !v->mb_type_base)
-            return -1;
+        !v->mb_type_base) {
+        av_freep(&v->mv_type_mb_plane);
+        av_freep(&v->direct_mb_plane);
+        av_freep(&v->acpred_plane);
+        av_freep(&v->over_flags_plane);
+        av_freep(&v->block);
+        av_freep(&v->cbp_base);
+        av_freep(&v->ttblk_base);
+        av_freep(&v->is_intra_base);
+        av_freep(&v->luma_mv_base);
+        av_freep(&v->mb_type_base);
+        return AVERROR(ENOMEM);
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list