openssl/Allow-NULL-arg-to-OSSL_STORE_close.patch

45 lines
1.5 KiB
Diff

From 767b86ee52227b1c8e5c783b9c3850fa65338058 Mon Sep 17 00:00:00 2001
From: "Dr. David von Oheimb" <David.von.Oheimb@siemens.com>
Date: Fri, 22 May 2020 14:56:06 +0200
Subject: [PATCH 066/217] Allow NULL arg to OSSL_STORE_close()
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(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 fb8184d..637466c 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 1e8ebf7..309390e 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<OSSL_STORE_CTX>, closes the channel that was opened
by OSSL_STORE_open() and frees all other information that was stored in the
B<OSSL_STORE_CTX>, as well as the B<OSSL_STORE_CTX> itself.
+If B<ctx> is NULL it does nothing.
=head1 SUPPORTED SCHEMES
--
1.8.3.1