Commit 52d2bcc7 authored by Michael Niedermayer's avatar Michael Niedermayer

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

Fixes CID1163842
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 78530240
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment