Skip to content

Commit

Permalink
avformat/jacosubdec: Cleanup when avpriv_bprint_to_extradata() fails
Browse files Browse the repository at this point in the history
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: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Nov 25, 2014
1 parent 3d5d95d commit 8cd80b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libavformat/jacosubdec.c
Expand Up @@ -232,7 +232,7 @@ static int jacosub_read_header(AVFormatContext *s)
/* general/essential directives in the extradata */
ret = avpriv_bprint_to_extradata(st->codec, &header);
if (ret < 0)
return ret;
goto fail;

/* SHIFT and TIMERES affect the whole script so packet timing can only be
* done in a second pass */
Expand All @@ -243,6 +243,9 @@ static int jacosub_read_header(AVFormatContext *s)
ff_subtitles_queue_finalize(&jacosub->q);

return 0;
fail:
jacosub_read_close(s);
return ret;
}

static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt)
Expand Down

0 comments on commit 8cd80b5

Please sign in to comment.