coverity 1462573 Dereference after null check
authorPauli <paul.dale@oracle.com>
Sun, 26 Apr 2020 23:17:48 +0000 (09:17 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 30 Apr 2020 10:21:33 +0000 (20:21 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11651)

crypto/evp/pmeth_gn.c

index dbc6c914e76497e7c8a0d2616cf0298e8dbeac39..dc1dad86ba9044af5506ea92f097da8500880ee3 100644 (file)
@@ -93,7 +93,7 @@ static int gen_init(EVP_PKEY_CTX *ctx, int operation)
 #endif
 
  end:
-    if (ret <= 0)
+    if (ret <= 0 && ctx != NULL)
         ctx->operation = EVP_PKEY_OP_UNDEFINED;
     return ret;