From: Tomas Mraz Date: Wed, 13 Nov 2019 10:04:08 +0000 (+0100) Subject: krb5kdf: Do not dereference NULL ctx when allocation fails X-Git-Tag: openssl-3.0.0-alpha11~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5764c3522c417fc775a78df4529e7a6f93379de8;p=thirdparty%2Fopenssl.git krb5kdf: Do not dereference NULL ctx when allocation fails Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13953) --- diff --git a/providers/implementations/kdfs/krb5kdf.c b/providers/implementations/kdfs/krb5kdf.c index cdf8a154157..c719dbf2597 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; }