]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
sm2: fix coverity 1467503: explicit null dereference
authorPauli <ppzgs1@gmail.com>
Fri, 19 Mar 2021 00:19:18 +0000 (10:19 +1000)
committerPauli <pauli@openssl.org>
Thu, 25 Mar 2021 22:44:04 +0000 (08:44 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14618)

providers/implementations/signature/sm2sig.c

index 6fb0ff919b1ea41f8b90505dc52ec5f1b13dde02..9016aefc029aad0968f7a36f657df18b90d561c8 100644 (file)
@@ -105,8 +105,8 @@ static void *sm2sig_newctx(void *provctx, const char *propq)
     ctx->libctx = PROV_LIBCTX_OF(provctx);
     if (propq != NULL && (ctx->propq = OPENSSL_strdup(propq)) == NULL) {
         OPENSSL_free(ctx);
-        ctx = NULL;
         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
+        return NULL;
     }
     /* don't allow to change MD, and in fact there is no such need */
     ctx->flag_allow_md = 0;