mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avcodec/motionpixels: Cleanup generically after init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
e42fc62633
commit
0f1db365c7
@ -81,19 +81,13 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
|
|||||||
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
|
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
|
||||||
mp->vpt = av_mallocz_array(avctx->height, sizeof(YuvPixel));
|
mp->vpt = av_mallocz_array(avctx->height, sizeof(YuvPixel));
|
||||||
mp->hpt = av_mallocz_array(h4 / 4, w4 / 4 * sizeof(YuvPixel));
|
mp->hpt = av_mallocz_array(h4 / 4, w4 / 4 * sizeof(YuvPixel));
|
||||||
if (!mp->changes_map || !mp->vpt || !mp->hpt) {
|
if (!mp->changes_map || !mp->vpt || !mp->hpt)
|
||||||
av_freep(&mp->changes_map);
|
|
||||||
av_freep(&mp->vpt);
|
|
||||||
av_freep(&mp->hpt);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
avctx->pix_fmt = AV_PIX_FMT_RGB555;
|
avctx->pix_fmt = AV_PIX_FMT_RGB555;
|
||||||
|
|
||||||
mp->frame = av_frame_alloc();
|
mp->frame = av_frame_alloc();
|
||||||
if (!mp->frame) {
|
if (!mp->frame)
|
||||||
mp_decode_end(avctx);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -354,4 +348,5 @@ AVCodec ff_motionpixels_decoder = {
|
|||||||
.close = mp_decode_end,
|
.close = mp_decode_end,
|
||||||
.decode = mp_decode_frame,
|
.decode = mp_decode_frame,
|
||||||
.capabilities = AV_CODEC_CAP_DR1,
|
.capabilities = AV_CODEC_CAP_DR1,
|
||||||
|
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user