From 767b86ee52227b1c8e5c783b9c3850fa65338058 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Fri, 22 May 2020 14:56:06 +0200 Subject: [PATCH] Allow NULL arg to OSSL_STORE_close() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11912) --- crypto/store/store_lib.c | 6 +++++- doc/man3/OSSL_STORE_open.pod | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c index fb8184d2d9..637466ce10 100644 --- a/crypto/store/store_lib.c +++ b/crypto/store/store_lib.c @@ -218,7 +218,11 @@ int OSSL_STORE_eof(OSSL_STORE_CTX *ctx) int OSSL_STORE_close(OSSL_STORE_CTX *ctx) { - int loader_ret = ctx->loader->close(ctx->loader_ctx); + int loader_ret; + + if (ctx == NULL) + return 1; + loader_ret = ctx->loader->close(ctx->loader_ctx); OPENSSL_free(ctx); return loader_ret; diff --git a/doc/man3/OSSL_STORE_open.pod b/doc/man3/OSSL_STORE_open.pod index 1e8ebf7ce1..309390efc3 100644 --- a/doc/man3/OSSL_STORE_open.pod +++ b/doc/man3/OSSL_STORE_open.pod @@ -94,6 +94,7 @@ OSSL_STORE_eof() shows that the end of data has been reached. OSSL_STORE_close() takes a B, closes the channel that was opened by OSSL_STORE_open() and frees all other information that was stored in the B, as well as the B itself. +If B is NULL it does nothing. =head1 SUPPORTED SCHEMES -- 2.25.1