[FFmpeg-cvslog] avcodec/vp9: use av_freep() for above_partition_ctx

Paul B Mahol git at videolan.org
Wed Nov 13 00:42:34 CET 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Nov 10 19:16:14 2013 +0000| [e1c7892013d2832df85dfef6368bd64e82547418] | committer: Paul B Mahol

avcodec/vp9: use av_freep() for above_partition_ctx

Fixes use after free if memory allocation fails.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/vp9.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index d26f122..4f9c1ad 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -254,7 +254,7 @@ static int update_size(AVCodecContext *ctx, int w, int h)
     s->rows     = (h + 7) >> 3;
 
 #define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var)
-    av_free(s->above_partition_ctx);
+    av_freep(&s->above_partition_ctx);
     p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) +
                                 64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2)));
     if (!p)



More information about the ffmpeg-cvslog mailing list