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@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
This commit is contained in:
Andreas Rheinhardt 2019-12-16 01:04:12 +01:00 committed by Steven Liu
parent 149ee954a3
commit 53c1458bf2
1 changed files with 1 additions and 1 deletions

View File

@ -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);