[FFmpeg-cvslog] avcodec/libopenjpegenc: Check the return code of av_frame_ref()

Michael Niedermayer git at videolan.org
Fri Jan 24 03:08:02 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 24 02:58:20 2014 +0100| [52d2bcc78632f868cc4045c8f1cd03533418f0b6] | committer: Michael Niedermayer

avcodec/libopenjpegenc: Check the return code of av_frame_ref()

Fixes CID1163842

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

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

 libavcodec/libopenjpegenc.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index e056dd7..f113be3 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -504,7 +504,10 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         gbrframe = av_frame_alloc();
         if (!gbrframe)
             return AVERROR(ENOMEM);
-        av_frame_ref(gbrframe, frame);
+        if ((ret = av_frame_ref(gbrframe, frame)) < 0) {
+            av_frame_free(&gbrframe);
+            return ret;
+        }
         gbrframe->data[0] = frame->data[2]; // swap to be rgb
         gbrframe->data[1] = frame->data[0];
         gbrframe->data[2] = frame->data[1];



More information about the ffmpeg-cvslog mailing list