From 53c1458bf2e91b2279985e5fc2ffaa5e2013564a Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 16 Dec 2019 01:04:12 +0100 Subject: [PATCH] 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 Reviewed-by: Steven Liu --- 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);