diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2017-12-25 23:51:25 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2017-12-25 23:51:25 +0800 |
commit | 2aee5a87233277027bb281372f888b5246a58e77 (patch) | |
tree | e8c28771206bd6e633659a1d2e2fe17bba9328bf /libavformat | |
parent | e712d301736106002264d631cff925a92dfe891d (diff) | |
download | ffmpeg-2aee5a87233277027bb281372f888b5246a58e77.tar.gz |
avformat/hlsenc: fix resource leak
fix CID: 1426931 1426929
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/hlsenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index b850b1a320..74f66ce6bd 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1899,11 +1899,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->filename); + av_free(old_filename); return ret; } write_styp(vs->out); ret = flush_dynbuf(vs, &range_length); if (ret < 0) { + av_free(old_filename); return ret; } ff_format_io_close(s, &vs->out); @@ -1979,16 +1981,17 @@ static int hls_write_trailer(struct AVFormatContext *s) ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, NULL); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->filename); - return AVERROR(ENOENT); + goto failed; } write_styp(vs->out); ret = flush_dynbuf(vs, &range_length); if (ret < 0) { - return ret; + goto failed; } ff_format_io_close(s, &vs->out); } +failed: av_write_trailer(oc); if (oc->pb) { vs->size = avio_tell(vs->avf->pb) - vs->start_pos; |