Fix null-pointer dereference
authorEdgar Pek <edgar.pek@gmail.com>
Sat, 21 Feb 2015 13:56:41 +0000 (14:56 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 22 Feb 2015 12:20:10 +0000 (13:20 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
engines/e_ubsec.c

index 2d6331d..6f09ffb 100644 (file)
@@ -967,11 +967,11 @@ static int ubsec_dh_generate_key(DH *dh)
 
     if (dh->pub_key == NULL) {
         pub_key = BN_new();
+        if (pub_key == NULL)
+            goto err;
         pub_key_len = BN_num_bits(dh->p);
         if (bn_wexpand(pub_key, dh->p->top) == NULL)
             goto err;
-        if (pub_key == NULL)
-            goto err;
     } else {
         pub_key = dh->pub_key;
     }