summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/aes/aes_wrap.c6
-rw-r--r--lib/libcrypto/asn1/asn1_gen.c6
-rw-r--r--lib/libcrypto/asn1/bio_ndef.c3
-rw-r--r--lib/libcrypto/bn/bn_exp.c3
-rw-r--r--lib/libcrypto/bn/bn_gf2m.c15
-rw-r--r--lib/libcrypto/cms/cms_env.c3
-rw-r--r--lib/libcrypto/cms/cms_ess.c3
-rw-r--r--lib/libcrypto/cms/cms_sd.c3
-rw-r--r--lib/libcrypto/dh/dh_ameth.c3
-rw-r--r--lib/libcrypto/dh/dh_pmeth.c3
-rw-r--r--lib/libcrypto/dsa/dsa_ameth.c6
-rw-r--r--lib/libcrypto/dsa/dsa_pmeth.c3
-rw-r--r--lib/libcrypto/ec/ec_ameth.c3
-rw-r--r--lib/libcrypto/ec/ec_asn1.c12
-rw-r--r--lib/libcrypto/ecdh/ech_ossl.c2
-rw-r--r--lib/libcrypto/engine/eng_dyn.c3
-rw-r--r--lib/libcrypto/ex_data.c9
-rw-r--r--lib/libcrypto/pem/pvkfmt.c3
-rw-r--r--lib/libcrypto/pkcs7/pk7_doit.c3
-rw-r--r--lib/libcrypto/rsa/rsa_pss.c6
-rw-r--r--lib/libcrypto/stack/stack.c3
-rw-r--r--lib/libcrypto/store/str_mem.c2
-rw-r--r--lib/libcrypto/ui/ui_lib.c12
-rw-r--r--lib/libcrypto/x509v3/v3_conf.c3
-rw-r--r--lib/libcrypto/x509v3/v3_utl.c5
25 files changed, 42 insertions, 81 deletions
diff --git a/lib/libcrypto/aes/aes_wrap.c b/lib/libcrypto/aes/aes_wrap.c
index 40533440bf3..4a830da7e42 100644
--- a/lib/libcrypto/aes/aes_wrap.c
+++ b/lib/libcrypto/aes/aes_wrap.c
@@ -164,10 +164,8 @@ AES_wrap_unwrap_test(const unsigned char *kek, int keybits,
ret = 1;
err:
- if (otmp)
- free(otmp);
- if (ptmp)
- free(ptmp);
+ free(otmp);
+ free(ptmp);
return ret;
}
diff --git a/lib/libcrypto/asn1/asn1_gen.c b/lib/libcrypto/asn1/asn1_gen.c
index 598a3222421..7abbac6059c 100644
--- a/lib/libcrypto/asn1/asn1_gen.c
+++ b/lib/libcrypto/asn1/asn1_gen.c
@@ -258,10 +258,8 @@ ASN1_generate_v3(char *str, X509V3_CTX *cnf)
ret = d2i_ASN1_TYPE(NULL, &cp, len);
err:
- if (orig_der)
- free(orig_der);
- if (new_der)
- free(new_der);
+ free(orig_der);
+ free(new_der);
return ret;
}
diff --git a/lib/libcrypto/asn1/bio_ndef.c b/lib/libcrypto/asn1/bio_ndef.c
index f00d38e5e4a..66be0251270 100644
--- a/lib/libcrypto/asn1/bio_ndef.c
+++ b/lib/libcrypto/asn1/bio_ndef.c
@@ -146,8 +146,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
err:
if (asn_bio)
BIO_free(asn_bio);
- if (ndef_aux)
- free(ndef_aux);
+ free(ndef_aux);
return NULL;
}
diff --git a/lib/libcrypto/bn/bn_exp.c b/lib/libcrypto/bn/bn_exp.c
index 0e36e8d7b55..5d9263e01eb 100644
--- a/lib/libcrypto/bn/bn_exp.c
+++ b/lib/libcrypto/bn/bn_exp.c
@@ -840,8 +840,7 @@ err:
BN_MONT_CTX_free(mont);
if (powerbuf != NULL) {
OPENSSL_cleanse(powerbuf, powerbufLen);
- if (powerbufFree)
- free(powerbufFree);
+ free(powerbufFree);
}
BN_CTX_end(ctx);
return (ret);
diff --git a/lib/libcrypto/bn/bn_gf2m.c b/lib/libcrypto/bn/bn_gf2m.c
index 669f8c403e1..4000fb8733f 100644
--- a/lib/libcrypto/bn/bn_gf2m.c
+++ b/lib/libcrypto/bn/bn_gf2m.c
@@ -558,8 +558,7 @@ BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p,
bn_check_top(r);
err:
- if (arr)
- free(arr);
+ free(arr);
return ret;
}
@@ -621,8 +620,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
bn_check_top(r);
err:
- if (arr)
- free(arr);
+ free(arr);
return ret;
}
@@ -1050,8 +1048,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p,
bn_check_top(r);
err:
- if (arr)
- free(arr);
+ free(arr);
return ret;
}
@@ -1113,8 +1110,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
bn_check_top(r);
err:
- if (arr)
- free(arr);
+ free(arr);
return ret;
}
@@ -1249,8 +1245,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
bn_check_top(r);
err:
- if (arr)
- free(arr);
+ free(arr);
return ret;
}
diff --git a/lib/libcrypto/cms/cms_env.c b/lib/libcrypto/cms/cms_env.c
index 78fa2aa7b73..5e6e7033b24 100644
--- a/lib/libcrypto/cms/cms_env.c
+++ b/lib/libcrypto/cms/cms_env.c
@@ -354,8 +354,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms,
err:
if (pctx)
EVP_PKEY_CTX_free(pctx);
- if (ek)
- free(ek);
+ free(ek);
return ret;
}
diff --git a/lib/libcrypto/cms/cms_ess.c b/lib/libcrypto/cms/cms_ess.c
index 99a4da63562..8dbd56ef2b6 100644
--- a/lib/libcrypto/cms/cms_ess.c
+++ b/lib/libcrypto/cms/cms_ess.c
@@ -156,8 +156,7 @@ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr)
if (!r)
CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE);
- if (rrder)
- free(rrder);
+ free(rrder);
return r;
diff --git a/lib/libcrypto/cms/cms_sd.c b/lib/libcrypto/cms/cms_sd.c
index d852af596d3..976881743bc 100644
--- a/lib/libcrypto/cms/cms_sd.c
+++ b/lib/libcrypto/cms/cms_sd.c
@@ -759,8 +759,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si)
return 1;
err:
- if (abuf)
- free(abuf);
+ free(abuf);
EVP_MD_CTX_cleanup(&mctx);
return 0;
diff --git a/lib/libcrypto/dh/dh_ameth.c b/lib/libcrypto/dh/dh_ameth.c
index a22614ae0a0..40e0202bff1 100644
--- a/lib/libcrypto/dh/dh_ameth.c
+++ b/lib/libcrypto/dh/dh_ameth.c
@@ -167,8 +167,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
return 1;
err:
- if (penc)
- free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
diff --git a/lib/libcrypto/dh/dh_pmeth.c b/lib/libcrypto/dh/dh_pmeth.c
index c359bb4d2ba..c70feb3789f 100644
--- a/lib/libcrypto/dh/dh_pmeth.c
+++ b/lib/libcrypto/dh/dh_pmeth.c
@@ -110,8 +110,7 @@ static int pkey_dh_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx)
{
DH_PKEY_CTX *dctx = ctx->data;
- if (dctx)
- free(dctx);
+ free(dctx);
}
static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
diff --git a/lib/libcrypto/dsa/dsa_ameth.c b/lib/libcrypto/dsa/dsa_ameth.c
index ebca5ec5c51..16617d40f5b 100644
--- a/lib/libcrypto/dsa/dsa_ameth.c
+++ b/lib/libcrypto/dsa/dsa_ameth.c
@@ -175,8 +175,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
return 1;
err:
- if (penc)
- free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
@@ -580,8 +579,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
goto err;
rv = 1;
err:
- if (m)
- free(m);
+ free(m);
DSA_SIG_free(dsa_sig);
return rv;
}
diff --git a/lib/libcrypto/dsa/dsa_pmeth.c b/lib/libcrypto/dsa/dsa_pmeth.c
index 4e77c6f64bb..a2b3b7f21a2 100644
--- a/lib/libcrypto/dsa/dsa_pmeth.c
+++ b/lib/libcrypto/dsa/dsa_pmeth.c
@@ -113,8 +113,7 @@ static int pkey_dsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
static void pkey_dsa_cleanup(EVP_PKEY_CTX *ctx)
{
DSA_PKEY_CTX *dctx = ctx->data;
- if (dctx)
- free(dctx);
+ free(dctx);
}
static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c
index 9b52c3cbfc8..b41879c4315 100644
--- a/lib/libcrypto/ec/ec_ameth.c
+++ b/lib/libcrypto/ec/ec_ameth.c
@@ -128,8 +128,7 @@ err:
ASN1_OBJECT_free(pval);
else
ASN1_STRING_free(pval);
- if (penc)
- free(penc);
+ free(penc);
return 0;
}
diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c
index 0ea0d6e2a43..2409cd0886c 100644
--- a/lib/libcrypto/ec/ec_asn1.c
+++ b/lib/libcrypto/ec/ec_asn1.c
@@ -507,10 +507,8 @@ ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve)
ok = 1;
-err: if (buffer_1)
- free(buffer_1);
- if (buffer_2)
- free(buffer_2);
+err: free(buffer_1);
+ free(buffer_2);
if (tmp_1)
BN_free(tmp_1);
if (tmp_2)
@@ -610,8 +608,7 @@ err: if (!ok) {
}
if (tmp)
BN_free(tmp);
- if (buffer)
- free(buffer);
+ free(buffer);
return (ret);
}
@@ -1134,8 +1131,7 @@ i2d_ECPrivateKey(EC_KEY * a, unsigned char **out)
}
ok = 1;
err:
- if (buffer)
- free(buffer);
+ free(buffer);
if (priv_key)
EC_PRIVATEKEY_free(priv_key);
return (ok ? ret : 0);
diff --git a/lib/libcrypto/ecdh/ech_ossl.c b/lib/libcrypto/ecdh/ech_ossl.c
index 129475f7bb4..0f4cdf056d5 100644
--- a/lib/libcrypto/ecdh/ech_ossl.c
+++ b/lib/libcrypto/ecdh/ech_ossl.c
@@ -204,6 +204,6 @@ err:
if (tmp) EC_POINT_free(tmp);
if (ctx) BN_CTX_end(ctx);
if (ctx) BN_CTX_free(ctx);
- if (buf) free(buf);
+ free(buf);
return(ret);
}
diff --git a/lib/libcrypto/engine/eng_dyn.c b/lib/libcrypto/engine/eng_dyn.c
index 7878bd802ec..f59d768350f 100644
--- a/lib/libcrypto/engine/eng_dyn.c
+++ b/lib/libcrypto/engine/eng_dyn.c
@@ -222,8 +222,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
/* If we lost the race to set the context, c is non-NULL and *ctx is the
* context of the thread that won. */
- if(c)
- free(c);
+ free(c);
return 1;
}
diff --git a/lib/libcrypto/ex_data.c b/lib/libcrypto/ex_data.c
index 77a91c4b046..d8d25d320ec 100644
--- a/lib/libcrypto/ex_data.c
+++ b/lib/libcrypto/ex_data.c
@@ -444,8 +444,7 @@ skip:
storage[i]->argl, storage[i]->argp);
}
}
- if (storage)
- free(storage);
+ free(storage);
return 1;
}
@@ -489,8 +488,7 @@ skip:
storage[i]->argl, storage[i]->argp);
CRYPTO_set_ex_data(to, i, ptr);
}
- if (storage)
- free(storage);
+ free(storage);
return 1;
}
@@ -527,8 +525,7 @@ skip:
storage[i]->argl, storage[i]->argp);
}
}
- if (storage)
- free(storage);
+ free(storage);
if (ad->sk) {
sk_void_free(ad->sk);
ad->sk = NULL;
diff --git a/lib/libcrypto/pem/pvkfmt.c b/lib/libcrypto/pem/pvkfmt.c
index a7815a23724..2dca955a40b 100644
--- a/lib/libcrypto/pem/pvkfmt.c
+++ b/lib/libcrypto/pem/pvkfmt.c
@@ -293,8 +293,7 @@ do_b2i_bio(BIO *in, int ispub)
ret = b2i_rsa(&p, length, bitlen, ispub);
err:
- if (buf)
- free(buf);
+ free(buf);
return ret;
}
diff --git a/lib/libcrypto/pkcs7/pk7_doit.c b/lib/libcrypto/pkcs7/pk7_doit.c
index 5aa4a914cf5..0f5d7479279 100644
--- a/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/lib/libcrypto/pkcs7/pk7_doit.c
@@ -190,8 +190,7 @@ static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri,
EVP_PKEY_free(pkey);
if (pctx)
EVP_PKEY_CTX_free(pctx);
- if (ek)
- free(ek);
+ free(ek);
return ret;
}
diff --git a/lib/libcrypto/rsa/rsa_pss.c b/lib/libcrypto/rsa/rsa_pss.c
index bd2fde07d43..1e060141659 100644
--- a/lib/libcrypto/rsa/rsa_pss.c
+++ b/lib/libcrypto/rsa/rsa_pss.c
@@ -172,8 +172,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
ret = 1;
err:
- if (DB)
- free(DB);
+ free(DB);
EVP_MD_CTX_cleanup(&ctx);
return ret;
@@ -284,8 +283,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
ret = 1;
err:
- if (salt)
- free(salt);
+ free(salt);
return ret;
diff --git a/lib/libcrypto/stack/stack.c b/lib/libcrypto/stack/stack.c
index e50967a0f1f..7eb00fd6e40 100644
--- a/lib/libcrypto/stack/stack.c
+++ b/lib/libcrypto/stack/stack.c
@@ -141,8 +141,7 @@ sk_new(int (*c)(const void *, const void *))
return (ret);
err:
- if (ret)
- free(ret);
+ free(ret);
return (NULL);
}
diff --git a/lib/libcrypto/store/str_mem.c b/lib/libcrypto/store/str_mem.c
index a73279c86b5..7e2346d93df 100644
--- a/lib/libcrypto/store/str_mem.c
+++ b/lib/libcrypto/store/str_mem.c
@@ -333,7 +333,7 @@ static int mem_list_end(STORE *s, void *handle)
}
if (context && context->search_attributes)
sk_STORE_ATTR_INFO_free(context->search_attributes);
- if (context) free(context);
+ free(context);
return 1;
}
static int mem_list_endp(STORE *s, void *handle)
diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c
index 5335b59c483..0d3a960052c 100644
--- a/lib/libcrypto/ui/ui_lib.c
+++ b/lib/libcrypto/ui/ui_lib.c
@@ -328,14 +328,10 @@ UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
result_buf);
err:
- if (prompt_copy)
- free(prompt_copy);
- if (action_desc_copy)
- free(action_desc_copy);
- if (ok_chars_copy)
- free(ok_chars_copy);
- if (cancel_chars_copy)
- free(cancel_chars_copy);
+ free(prompt_copy);
+ free(action_desc_copy);
+ free(ok_chars_copy);
+ free(cancel_chars_copy);
return -1;
}
diff --git a/lib/libcrypto/x509v3/v3_conf.c b/lib/libcrypto/x509v3/v3_conf.c
index e22aa50fcd3..bfdb473b199 100644
--- a/lib/libcrypto/x509v3/v3_conf.c
+++ b/lib/libcrypto/x509v3/v3_conf.c
@@ -313,8 +313,7 @@ v3_generic_extension(const char *ext, char *value, int crit, int gen_type,
err:
ASN1_OBJECT_free(obj);
M_ASN1_OCTET_STRING_free(oct);
- if (ext_der)
- free(ext_der);
+ free(ext_der);
return extension;
}
diff --git a/lib/libcrypto/x509v3/v3_utl.c b/lib/libcrypto/x509v3/v3_utl.c
index c3328d668dd..5b064f8eb25 100644
--- a/lib/libcrypto/x509v3/v3_utl.c
+++ b/lib/libcrypto/x509v3/v3_utl.c
@@ -422,7 +422,7 @@ unsigned char *string_to_hex(const char *str, long *len)
return hexbuf;
err:
- if(hexbuf) free(hexbuf);
+ free(hexbuf);
X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE);
return NULL;
@@ -623,8 +623,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc)
return ret;
err:
- if (iptmp)
- free(iptmp);
+ free(iptmp);
if (ret)
ASN1_OCTET_STRING_free(ret);
return NULL;