1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-06 08:29:25 +02:00

avcodec/hcom: Cleanup generically upon init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt
2020-09-14 17:39:55 +02:00
parent 8da8774d8e
commit 0bb5cc0ee9

View File

@@ -67,15 +67,11 @@ static av_cold int hcom_init(AVCodecContext *avctx)
if (s->dict[i].l >= 0 && if (s->dict[i].l >= 0 &&
(s->dict[i].l >= s->dict_entries || (s->dict[i].l >= s->dict_entries ||
s->dict[i].r >= s->dict_entries || s->dict[i].r >= s->dict_entries ||
s->dict[i].r < 0 )) { s->dict[i].r < 0 ))
av_freep(&s->dict);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
}
} }
if (s->dict[0].l < 0) { if (s->dict[0].l < 0)
av_freep(&s->dict);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
}
avctx->sample_fmt = AV_SAMPLE_FMT_U8; avctx->sample_fmt = AV_SAMPLE_FMT_U8;
s->dict_entry = 0; s->dict_entry = 0;
@@ -148,4 +144,5 @@ AVCodec ff_hcom_decoder = {
.close = hcom_close, .close = hcom_close,
.decode = hcom_decode, .decode = hcom_decode,
.capabilities = AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };