diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-16 21:17:34 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-16 21:17:34 +0300 |
commit | 51ddaf65496bc8a7d3f62cafec5c08dc4e55909f (patch) | |
tree | c5a69d825ff4e9e9e0b08a939ffd855a51a4c3e2 /libavformat/mpeg.c | |
parent | 62eca2f827d441f52125191fd78c96b67a7ba30c (diff) |
avformat/mpeg: fix memleak of sub_name on error
Fixes CID1254666
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r-- | libavformat/mpeg.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index e8e1b085c8..827a3c2c5f 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -697,12 +697,16 @@ static int vobsub_read_header(AVFormatContext *s) memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3); av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name); - if (!(iformat = av_find_input_format("mpeg"))) - return AVERROR_DEMUXER_NOT_FOUND; + if (!(iformat = av_find_input_format("mpeg"))) { + ret = AVERROR_DEMUXER_NOT_FOUND; + goto end; + } vobsub->sub_ctx = avformat_alloc_context(); - if (!vobsub->sub_ctx) - return AVERROR(ENOMEM); + if (!vobsub->sub_ctx) { + ret = AVERROR(ENOMEM); + goto end; + } if ((ret = ff_copy_whitelists(vobsub->sub_ctx, s)) < 0) goto end; |