diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-04-13 09:08:07 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-04-17 11:39:12 +0200 |
commit | cd69b4bd7cffa2f52ab35cdf47b6d95775a4a84b (patch) | |
tree | 7acae32109d03f182901b3e18dfc1186c6dfa517 /crypto/cmp | |
parent | e494fac705057c91017b41fa761f9406c87f4cc5 (diff) |
OSSL_CMP_CTX_new(): Fix distinction of out-of-memory and other errors
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14889)
Diffstat (limited to 'crypto/cmp')
-rw-r--r-- | crypto/cmp/cmp_ctx.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index 0016569356..110361320d 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -108,7 +108,7 @@ OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq) ctx->libctx = libctx; if (propq != NULL && (ctx->propq = OPENSSL_strdup(propq)) == NULL) - goto err; + goto oom; ctx->log_verbosity = OSSL_CMP_LOG_INFO; @@ -118,7 +118,7 @@ OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq) ctx->msg_timeout = 2 * 60; if ((ctx->untrusted = sk_X509_new_null()) == NULL) - goto err; + goto oom; ctx->pbm_slen = 16; if (!cmp_ctx_set_md(ctx, &ctx->pbm_owf, NID_sha256)) @@ -134,9 +134,10 @@ OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq) /* all other elements are initialized to 0 or NULL, respectively */ return ctx; + oom: + ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE); err: OSSL_CMP_CTX_free(ctx); - ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE); return NULL; } |