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

Fixes CID1163842

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/54/head
Michael Niedermayer 11 years ago
parent 7853024071
commit 52d2bcc786
  1. 5
      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];

Loading…
Cancel
Save