Commit 8cd80b5f authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/jacosubdec: Cleanup when avpriv_bprint_to_extradata() fails

Fixes memleaks
Fixes: asan_heap-oob_4d2250_814_cov_2745172097_JACOsub_capability_tester.jss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 3d5d95db
...@@ -232,7 +232,7 @@ static int jacosub_read_header(AVFormatContext *s) ...@@ -232,7 +232,7 @@ static int jacosub_read_header(AVFormatContext *s)
/* general/essential directives in the extradata */ /* general/essential directives in the extradata */
ret = avpriv_bprint_to_extradata(st->codec, &header); ret = avpriv_bprint_to_extradata(st->codec, &header);
if (ret < 0) if (ret < 0)
return ret; goto fail;
/* SHIFT and TIMERES affect the whole script so packet timing can only be /* SHIFT and TIMERES affect the whole script so packet timing can only be
* done in a second pass */ * done in a second pass */
...@@ -243,6 +243,9 @@ static int jacosub_read_header(AVFormatContext *s) ...@@ -243,6 +243,9 @@ static int jacosub_read_header(AVFormatContext *s)
ff_subtitles_queue_finalize(&jacosub->q); ff_subtitles_queue_finalize(&jacosub->q);
return 0; return 0;
fail:
jacosub_read_close(s);
return ret;
} }
static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt) static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment