PACKET unit tests
[openssl.git] / test / ecdsatest.c
index 3a455b4747bc63e1329ee4bf27d8a72e9060b89a..377e2c53673b657d60913ab2818c52b7a2575c3c 100644 (file)
@@ -241,17 +241,12 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
     if (!ret)
         BIO_printf(out, " failed\n");
     EC_KEY_free(key);
-    if (signature)
-        ECDSA_SIG_free(signature);
-    if (r)
-        BN_free(r);
-    if (s)
-        BN_free(s);
+    ECDSA_SIG_free(signature);
+    BN_free(r);
+    BN_free(s);
     EVP_MD_CTX_cleanup(&md_ctx);
-    if (kinv)
-        BN_clear_free(kinv);
-    if (rp)
-        BN_clear_free(rp);
+    BN_clear_free(kinv);
+    BN_clear_free(rp);
     return ret;
 }
 
@@ -323,9 +318,7 @@ int test_builtin(BIO *out)
 
     /* get a list of all internal curves */
     crv_len = EC_get_builtin_curves(NULL, 0);
-
-    curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);
-
+    curves = OPENSSL_malloc(sizeof(*curves) * crv_len);
     if (curves == NULL) {
         BIO_printf(out, "malloc error\n");
         goto builtin_err;
@@ -506,14 +499,10 @@ int test_builtin(BIO *out)
  builtin_err:
     EC_KEY_free(eckey);
     EC_KEY_free(wrong_eckey);
-    if (ecdsa_sig)
-        ECDSA_SIG_free(ecdsa_sig);
-    if (signature)
-        OPENSSL_free(signature);
-    if (raw_buf)
-        OPENSSL_free(raw_buf);
-    if (curves)
-        OPENSSL_free(curves);
+    ECDSA_SIG_free(ecdsa_sig);
+    OPENSSL_free(signature);
+    OPENSSL_free(raw_buf);
+    OPENSSL_free(curves);
 
     return ret;
 }