[FFmpeg-cvslog] avformat/hlsenc: Check ret

Michael Niedermayer git at videolan.org
Wed Jul 24 17:50:38 EEST 2024


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jul 11 18:37:54 2024 +0200| [a7c43833f29a7cb99627ac29820eea34ae3416aa] | committer: Michael Niedermayer

avformat/hlsenc: Check ret

Fixes: CID1609624 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7e577165c101513b4d8afe164e604cbef6901546)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7c43833f29a7cb99627ac29820eea34ae3416aa
---

 libavformat/hlsenc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index c9b30612d8..6acedbf322 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2439,8 +2439,10 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                            " will retry with a new http session.\n");
                     ff_format_io_close(s, &vs->out);
                     ret = hlsenc_io_open(s, &vs->out, filename, &options);
-                    reflush_dynbuf(vs, &range_length);
-                    ret = hlsenc_io_close(s, &vs->out, filename);
+                    if (ret >= 0) {
+                        reflush_dynbuf(vs, &range_length);
+                        ret = hlsenc_io_close(s, &vs->out, filename);
+                    }
                 }
                 av_dict_free(&options);
                 av_freep(&vs->temp_buffer);
@@ -2451,6 +2453,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                 hls_rename_temp_file(s, oc);
         }
 
+        if (ret < 0)
+            return ret;
+
         old_filename = av_strdup(oc->url);
         if (!old_filename) {
             return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list