[FFmpeg-devel] [PATCH 5/7] lavc/libopenjpegenc: check av_frame_alloc() failure.

Nicolas George george at nsup.org
Sun Dec 29 11:11:46 CET 2013


Signed-off-by: Nicolas George <george at nsup.org>
---
 libavcodec/libopenjpegenc.c | 2 ++
 1 file changed, 2 insertions(+)


Completely untested (my vacation box is slow, I did not feel like rebuilding
the whole project enabling libopenjpegenc just for that.


diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 0205c7d..e056dd7 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -502,6 +502,8 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     case AV_PIX_FMT_GBRP14:
     case AV_PIX_FMT_GBRP16:
         gbrframe = av_frame_alloc();
+        if (!gbrframe)
+            return AVERROR(ENOMEM);
         av_frame_ref(gbrframe, frame);
         gbrframe->data[0] = frame->data[2]; // swap to be rgb
         gbrframe->data[1] = frame->data[0];
-- 
1.8.5.2



More information about the ffmpeg-devel mailing list