apps/s_server.c: Add check for OPENSSL_strdup

As the potential failure of the OPENSSL_strdup(),
it should be better to check the return value and
return error if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18595)
This commit is contained in:
Jiasheng Jiang 2022-06-17 17:44:24 +08:00 committed by Pauli
parent e163969d35
commit a6a2dd9f60

View File

@ -1168,6 +1168,8 @@ int s_server_main(int argc, char *argv[])
case OPT_UNIX:
socket_family = AF_UNIX;
OPENSSL_free(host); host = OPENSSL_strdup(opt_arg());
if (host == NULL)
goto end;
OPENSSL_free(port); port = NULL;
break;
case OPT_UNLINK: