tool_writeout: check gmtime return code too

If the unlikely event happen that it fails, it returns NULL.
CodeSonar is not happy unless we check for it.

Closes #18225
This commit is contained in:
Daniel Stenberg 2025-08-08 09:24:46 +02:00
parent 673b6c8cb8
commit 065a653158
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -603,7 +603,7 @@ static const char *outtime(const char *ptr, /* %time{ ... */
if(!result) {
/* !checksrc! disable BANNEDFUNC 1 */
utc = gmtime(&secs);
if(curlx_dyn_len(&format) &&
if(curlx_dyn_len(&format) && utc &&
strftime(output, sizeof(output), curlx_dyn_ptr(&format), utc))
fputs(output, stream);
curlx_dyn_free(&format);