[FFmpeg-cvslog] ffv1: check for malloc failure

Michael Niedermayer git at videolan.org
Tue Feb 5 00:37:48 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Feb  5 00:22:29 2013 +0100| [5a8311513091ea7277578fbaf189e460dd1d4c7d] | committer: Michael Niedermayer

ffv1: check for malloc failure

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

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

 libavcodec/ffv1.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 074be4c..29d76ed 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -123,6 +123,10 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
         int sxe         = f->avctx->width  * (sx + 1) / f->num_h_slices;
         int sys         = f->avctx->height *  sy      / f->num_v_slices;
         int sye         = f->avctx->height * (sy + 1) / f->num_v_slices;
+
+        if (!fs)
+            return AVERROR(ENOMEM);
+
         f->slice_context[i] = fs;
         memcpy(fs, f, sizeof(*fs));
         memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2));



More information about the ffmpeg-cvslog mailing list