avcodec/indeo3: Cleanup generically after init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-09-14 19:58:07 +02:00
parent ab4876163b
commit 3507ab07ec
1 changed files with 2 additions and 3 deletions

View File

@ -203,10 +203,8 @@ static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx,
ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size);
ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size);
if (!ctx->planes[p].buffers[0] || !ctx->planes[p].buffers[1]) {
free_frame_buffers(ctx);
if (!ctx->planes[p].buffers[0] || !ctx->planes[p].buffers[1])
return AVERROR(ENOMEM);
}
/* fill the INTRA prediction lines with the middle pixel value = 64 */
memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch);
@ -1143,4 +1141,5 @@ AVCodec ff_indeo3_decoder = {
.close = decode_close,
.decode = decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};