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:23:53 +0000 (13:23 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit bcfa19a8d19506c26b5f8d9d9934ca2aa5f96b43)

engines/e_ubsec.c

index 2d6331d690e27a366ff7934a6efd39d6fead2a75..6f09ffb965ca66847d775ec3ed862a3f9fb3127d 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;
     }