mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
jpeg2000dec: fix memleaks in error cases in jpeg2000_decode_frame()
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a82cc54fb5
commit
974420a701
@ -1288,26 +1288,29 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return -1;
|
||||
}
|
||||
if (ret = jpeg2000_read_main_headers(s))
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
/* get picture buffer */
|
||||
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed.\n");
|
||||
return ret;
|
||||
goto fail;
|
||||
}
|
||||
picture->pict_type = AV_PICTURE_TYPE_I;
|
||||
picture->key_frame = 1;
|
||||
|
||||
if (ret = jpeg2000_read_bitstream_packets(s))
|
||||
return ret;
|
||||
goto fail;
|
||||
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
|
||||
if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
|
||||
return ret;
|
||||
goto fail;
|
||||
jpeg2000_dec_cleanup(s);
|
||||
|
||||
*got_frame = 1;
|
||||
|
||||
return s->buf - s->buf_start;
|
||||
fail:
|
||||
jpeg2000_dec_cleanup(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
|
||||
|
Loading…
Reference in New Issue
Block a user