diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-10 22:05:20 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-16 02:37:26 +0100 |
commit | cee04cbfe1bf77db5a5bb4ade786573f08a586fc (patch) | |
tree | 435d69f3c57c3f76fc0ec206d0dd6956df5a7b03 /libavcodec/pgssubdec.c | |
parent | d59f454ed2ba4cc89533a84d727eef9aaaed635d (diff) | |
download | ffmpeg-cee04cbfe1bf77db5a5bb4ade786573f08a586fc.tar.gz |
avcodec/decode: Fix leaks upon subtitle decoding errors
Up until now, various subtitle decoders have not cleaned up
the AVSubtitle on error; this task must not be left to the user
because the documentation explicitly states that the AVSubtitle
"must be freed with avsubtitle_free if *got_sub_ptr is set"
(which it isn't on error).
Leaks happen upon failure in ff_ass_add_rect() or in
ass_decode_frame(); freeing generically also allows to remove
now redundant freeing code in pgssubdec and dvbsubdec.
While just at it, also reset got_sub_ptr generically on error.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r-- | libavcodec/pgssubdec.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 8a200aa01b..bdd20c914b 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -667,11 +667,8 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub_ptr, break; } if (ret < 0 && (ret == AVERROR(ENOMEM) || - avctx->err_recognition & AV_EF_EXPLODE)) { - avsubtitle_free(data); - *got_sub_ptr = 0; + avctx->err_recognition & AV_EF_EXPLODE)) return ret; - } buf += segment_length; } |