From 5764c3522c417fc775a78df4529e7a6f93379de8 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 13 Nov 2019 11:04:08 +0100 Subject: krb5kdf: Do not dereference NULL ctx when allocation fails Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13953) --- providers/implementations/kdfs/krb5kdf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'providers/implementations/kdfs') diff --git a/providers/implementations/kdfs/krb5kdf.c b/providers/implementations/kdfs/krb5kdf.c index cdf8a15415..c719dbf259 100644 --- a/providers/implementations/kdfs/krb5kdf.c +++ b/providers/implementations/kdfs/krb5kdf.c @@ -63,8 +63,10 @@ static void *krb5kdf_new(void *provctx) if (!ossl_prov_is_running()) return NULL; - if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) + if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) { ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE); + return NULL; + } ctx->provctx = provctx; return ctx; } -- cgit v1.2.3