Browse Source

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>
tags/n4.3
Andreas Rheinhardt Steven Liu 6 years ago
parent
commit
53c1458bf2
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavformat/hlsenc.c

+ 1
- 1
libavformat/hlsenc.c 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);


Loading…
Cancel
Save