[FFmpeg-devel] [PATCH] avformat/hlsenc: checking return value of avio_open_dyn_buf

Steven Liu lq at chinaffmpeg.org
Thu Nov 16 04:53:50 EET 2017


fix CID: 1421196

Signed-off-by: Steven Liu <lq at onvideo.cn>
---
 libavformat/hlsenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e0cef8b879..54342cf288 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1678,7 +1678,11 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                 range_length = avio_close_dyn_buf(oc->pb, &buffer);
                 avio_write(hls->out, buffer, range_length);
                 hls->init_range_length = range_length;
-                avio_open_dyn_buf(&oc->pb);
+                ret = avio_open_dyn_buf(&oc->pb);
+                if (ret < 0) {
+                    av_free(old_filename);
+                    return ret;
+                }
                 hls->packets_written = 0;
                 ff_format_io_close(s, &hls->out);
             } else {
-- 
2.11.0 (Apple Git-81)





More information about the ffmpeg-devel mailing list