summaryrefslogtreecommitdiff
path: root/libavcodec/hcom.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-14 17:39:55 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-15 19:25:26 +0200
commit0bb5cc0ee959bdc2ff439a149343bc1a53998f31 (patch)
tree4b0104835eb8a1abd619b2810e0dcc0570c321e6 /libavcodec/hcom.c
parent8da8774d8eb1d5dec830f36d2e6b0ace1b16e2f5 (diff)
avcodec/hcom: Cleanup generically upon init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/hcom.c')
-rw-r--r--libavcodec/hcom.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index 8300676f98..06fa25fcd2 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -67,15 +67,11 @@ static av_cold int hcom_init(AVCodecContext *avctx)
if (s->dict[i].l >= 0 &&
(s->dict[i].l >= s->dict_entries ||
s->dict[i].r >= s->dict_entries ||
- s->dict[i].r < 0 )) {
- av_freep(&s->dict);
+ s->dict[i].r < 0 ))
return AVERROR_INVALIDDATA;
- }
}
- if (s->dict[0].l < 0) {
- av_freep(&s->dict);
+ if (s->dict[0].l < 0)
return AVERROR_INVALIDDATA;
- }
avctx->sample_fmt = AV_SAMPLE_FMT_U8;
s->dict_entry = 0;
@@ -148,4 +144,5 @@ AVCodec ff_hcom_decoder = {
.close = hcom_close,
.decode = hcom_decode,
.capabilities = AV_CODEC_CAP_DR1,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};