[FFmpeg-cvslog] avformat/hlsenc: Fix return value from localtime_r failure

Andreas Rheinhardt git at videolan.org
Mon Dec 23 08:19:04 EET 2019


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Dec 16 01:04:12 2019 +0100| [53c1458bf2e91b2279985e5fc2ffaa5e2013564a] | committer: Steven Liu

avformat/hlsenc: Fix return value from localtime_r failure

"If an error is detected, localtime_r() shall return a null pointer
and set errno to indicate the error." Yet in case this happened in
hls_init(), AVERROR(ENOMEM) has been returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Reviewed-by: Steven Liu <lq at onvideo.cn>

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

 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f804250c09..f3e89a033f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2737,7 +2737,7 @@ static int hls_init(AVFormatContext *s)
             char b[15];
             struct tm *p, tmbuf;
             if (!(p = localtime_r(&t, &tmbuf)))
-                return AVERROR(ENOMEM);
+                return AVERROR(errno);
             if (!strftime(b, sizeof(b), "%Y%m%d%H%M%S", p))
                 return AVERROR(ENOMEM);
             hls->start_sequence = strtoll(b, NULL, 10);



More information about the ffmpeg-cvslog mailing list