mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-28 02:02:46 +00:00
avformat/hlsenc: fix resource leak
fix CID: 1426931 1426929
This commit is contained in:
parent
e712d30173
commit
2aee5a8723
@ -1899,11 +1899,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n",
|
av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n",
|
||||||
vs->avf->filename);
|
vs->avf->filename);
|
||||||
|
av_free(old_filename);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
write_styp(vs->out);
|
write_styp(vs->out);
|
||||||
ret = flush_dynbuf(vs, &range_length);
|
ret = flush_dynbuf(vs, &range_length);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
av_free(old_filename);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ff_format_io_close(s, &vs->out);
|
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);
|
ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->filename);
|
av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->filename);
|
||||||
return AVERROR(ENOENT);
|
goto failed;
|
||||||
}
|
}
|
||||||
write_styp(vs->out);
|
write_styp(vs->out);
|
||||||
ret = flush_dynbuf(vs, &range_length);
|
ret = flush_dynbuf(vs, &range_length);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
goto failed;
|
||||||
}
|
}
|
||||||
ff_format_io_close(s, &vs->out);
|
ff_format_io_close(s, &vs->out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
failed:
|
||||||
av_write_trailer(oc);
|
av_write_trailer(oc);
|
||||||
if (oc->pb) {
|
if (oc->pb) {
|
||||||
vs->size = avio_tell(vs->avf->pb) - vs->start_pos;
|
vs->size = avio_tell(vs->avf->pb) - vs->start_pos;
|
||||||
|
Loading…
Reference in New Issue
Block a user