coverity 1456640: fix null check
authorPauli <paul.dale@oracle.com>
Fri, 3 Jan 2020 09:22:50 +0000 (19:22 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 5 Jan 2020 08:05:14 +0000 (18:05 +1000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10748)

providers/implementations/serializers/serializer_dh_priv.c

index 80d87ac738271a38bea7e07f24da2d7a3c181162..a6427dc867276ca86e72cc33250ee7b3a55d87b6 100644 (file)
@@ -48,11 +48,10 @@ static void *dh_priv_newctx(void *provctx)
 
     if (ctx != NULL) {
         ctx->provctx = provctx;
-    }
-
-    /* -1 is the "whatever" indicator, i.e. the PKCS8 library default PBE */
-    ctx->sc.pbe_nid = -1;
 
+        /* -1 is the "whatever" indicator, i.e. the PKCS8 library default PBE */
+        ctx->sc.pbe_nid = -1;
+    }
     return ctx;
 }