summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libcrypto/asn1/ameth_lib.c6
-rw-r--r--lib/libcrypto/asn1/asn1_lib.c3
-rw-r--r--lib/libcrypto/asn1/asn_mime.c12
-rw-r--r--lib/libcrypto/asn1/bio_asn1.c3
-rw-r--r--lib/libcrypto/asn1/bio_ndef.c3
-rw-r--r--lib/libcrypto/asn1/tasn_dec.c3
-rw-r--r--lib/libcrypto/asn1/tasn_utl.c6
-rw-r--r--lib/libcrypto/asn1/x_name.c3
-rw-r--r--lib/libcrypto/asn1/x_pubkey.c3
-rw-r--r--lib/libcrypto/conf/conf_mod.c6
-rw-r--r--lib/libcrypto/dh/dh_lib.c2
-rw-r--r--lib/libcrypto/dso/dso_lib.c3
-rw-r--r--lib/libcrypto/ec/ec_lib.c9
-rw-r--r--lib/libcrypto/engine/hw_cryptodev.c3
-rw-r--r--lib/libcrypto/evp/evp_enc.c3
-rw-r--r--lib/libcrypto/ocsp/ocsp_ht.c3
-rw-r--r--lib/libcrypto/rsa/rsa_pmeth.c3
-rw-r--r--lib/libcrypto/x509/by_dir.c3
-rw-r--r--lib/libcrypto/x509/x509_vpm.c3
19 files changed, 27 insertions, 53 deletions
diff --git a/lib/libcrypto/asn1/ameth_lib.c b/lib/libcrypto/asn1/ameth_lib.c
index 8652e938bdc..771b4f96904 100644
--- a/lib/libcrypto/asn1/ameth_lib.c
+++ b/lib/libcrypto/asn1/ameth_lib.c
@@ -380,10 +380,8 @@ void
EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth)
{
if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) {
- if (ameth->pem_str)
- free(ameth->pem_str);
- if (ameth->info)
- free(ameth->info);
+ free(ameth->pem_str);
+ free(ameth->info);
free(ameth);
}
}
diff --git a/lib/libcrypto/asn1/asn1_lib.c b/lib/libcrypto/asn1/asn1_lib.c
index c2f0837a1c6..b28cdc56cff 100644
--- a/lib/libcrypto/asn1/asn1_lib.c
+++ b/lib/libcrypto/asn1/asn1_lib.c
@@ -401,8 +401,7 @@ ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
void
ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
{
- if (str->data)
- free(str->data);
+ free(str->data);
str->data = data;
str->length = len;
}
diff --git a/lib/libcrypto/asn1/asn_mime.c b/lib/libcrypto/asn1/asn_mime.c
index 5d70b76f058..f123a7ddc0a 100644
--- a/lib/libcrypto/asn1/asn_mime.c
+++ b/lib/libcrypto/asn1/asn_mime.c
@@ -949,10 +949,8 @@ mime_param_find(MIME_HEADER *hdr, char *name)
static void
mime_hdr_free(MIME_HEADER *hdr)
{
- if (hdr->name)
- free(hdr->name);
- if (hdr->value)
- free(hdr->value);
+ free(hdr->name);
+ free(hdr->value);
if (hdr->params)
sk_MIME_PARAM_pop_free(hdr->params, mime_param_free);
free(hdr);
@@ -961,10 +959,8 @@ mime_hdr_free(MIME_HEADER *hdr)
static void
mime_param_free(MIME_PARAM *param)
{
- if (param->param_name)
- free(param->param_name);
- if (param->param_value)
- free(param->param_value);
+ free(param->param_name);
+ free(param->param_value);
free(param);
}
diff --git a/lib/libcrypto/asn1/bio_asn1.c b/lib/libcrypto/asn1/bio_asn1.c
index 327355eeda5..223461d933a 100644
--- a/lib/libcrypto/asn1/bio_asn1.c
+++ b/lib/libcrypto/asn1/bio_asn1.c
@@ -186,8 +186,7 @@ asn1_bio_free(BIO *b)
ctx = (BIO_ASN1_BUF_CTX *) b->ptr;
if (ctx == NULL)
return 0;
- if (ctx->buf)
- free(ctx->buf);
+ free(ctx->buf);
free(ctx);
b->init = 0;
b->ptr = NULL;
diff --git a/lib/libcrypto/asn1/bio_ndef.c b/lib/libcrypto/asn1/bio_ndef.c
index 66be0251270..f7fa2e69bc2 100644
--- a/lib/libcrypto/asn1/bio_ndef.c
+++ b/lib/libcrypto/asn1/bio_ndef.c
@@ -186,8 +186,7 @@ ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
ndef_aux = *(NDEF_SUPPORT **)parg;
- if (ndef_aux->derbuf)
- free(ndef_aux->derbuf);
+ free(ndef_aux->derbuf);
ndef_aux->derbuf = NULL;
*pbuf = NULL;
diff --git a/lib/libcrypto/asn1/tasn_dec.c b/lib/libcrypto/asn1/tasn_dec.c
index c8b379f371f..b524104d91c 100644
--- a/lib/libcrypto/asn1/tasn_dec.c
+++ b/lib/libcrypto/asn1/tasn_dec.c
@@ -951,8 +951,7 @@ asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,
}
/* If we've already allocated a buffer use it */
if (*free_cont) {
- if (stmp->data)
- free(stmp->data);
+ free(stmp->data);
stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */
stmp->length = len;
*free_cont = 0;
diff --git a/lib/libcrypto/asn1/tasn_utl.c b/lib/libcrypto/asn1/tasn_utl.c
index e1051c2c3e5..446a6f82bd2 100644
--- a/lib/libcrypto/asn1/tasn_utl.c
+++ b/lib/libcrypto/asn1/tasn_utl.c
@@ -153,8 +153,7 @@ asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
enc = asn1_get_enc_ptr(pval, it);
if (enc) {
- if (enc->enc)
- free(enc->enc);
+ free(enc->enc);
enc->enc = NULL;
enc->len = 0;
enc->modified = 1;
@@ -171,8 +170,7 @@ asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
if (!enc)
return 1;
- if (enc->enc)
- free(enc->enc);
+ free(enc->enc);
enc->enc = malloc(inlen);
if (!enc->enc)
return 0;
diff --git a/lib/libcrypto/asn1/x_name.c b/lib/libcrypto/asn1/x_name.c
index 70459babc43..366ff179769 100644
--- a/lib/libcrypto/asn1/x_name.c
+++ b/lib/libcrypto/asn1/x_name.c
@@ -164,8 +164,7 @@ x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
BUF_MEM_free(a->bytes);
sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free);
- if (a->canon_enc)
- free(a->canon_enc);
+ free(a->canon_enc);
free(a);
*pval = NULL;
}
diff --git a/lib/libcrypto/asn1/x_pubkey.c b/lib/libcrypto/asn1/x_pubkey.c
index df915e2dfd0..f8b22fc3723 100644
--- a/lib/libcrypto/asn1/x_pubkey.c
+++ b/lib/libcrypto/asn1/x_pubkey.c
@@ -355,8 +355,7 @@ X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype,
if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
return 0;
if (penc) {
- if (pub->public_key->data)
- free(pub->public_key->data);
+ free(pub->public_key->data);
pub->public_key->data = penc;
pub->public_key->length = penclen;
/* Set number of unused bits to zero */
diff --git a/lib/libcrypto/conf/conf_mod.c b/lib/libcrypto/conf/conf_mod.c
index b5741047914..f7fdbfa6704 100644
--- a/lib/libcrypto/conf/conf_mod.c
+++ b/lib/libcrypto/conf/conf_mod.c
@@ -386,10 +386,8 @@ err:
memerr:
if (imod) {
- if (imod->name)
- free(imod->name);
- if (imod->value)
- free(imod->value);
+ free(imod->name);
+ free(imod->value);
free(imod);
}
diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c
index e09c5fdd21c..7a680cc5b48 100644
--- a/lib/libcrypto/dh/dh_lib.c
+++ b/lib/libcrypto/dh/dh_lib.c
@@ -193,7 +193,7 @@ void DH_free(DH *r)
if (r->g != NULL) BN_clear_free(r->g);
if (r->q != NULL) BN_clear_free(r->q);
if (r->j != NULL) BN_clear_free(r->j);
- if (r->seed) free(r->seed);
+ free(r->seed);
if (r->counter != NULL) BN_clear_free(r->counter);
if (r->pub_key != NULL) BN_clear_free(r->pub_key);
if (r->priv_key != NULL) BN_clear_free(r->priv_key);
diff --git a/lib/libcrypto/dso/dso_lib.c b/lib/libcrypto/dso/dso_lib.c
index 882b9c2fcbf..3859be7b42f 100644
--- a/lib/libcrypto/dso/dso_lib.c
+++ b/lib/libcrypto/dso/dso_lib.c
@@ -361,8 +361,7 @@ DSO_set_filename(DSO *dso, const char *filename)
DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
return (0);
}
- if (dso->filename)
- free(dso->filename);
+ free(dso->filename);
dso->filename = copied;
return (1);
}
diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c
index b37efac246a..3313573a05c 100644
--- a/lib/libcrypto/ec/ec_lib.c
+++ b/lib/libcrypto/ec/ec_lib.c
@@ -130,8 +130,7 @@ EC_GROUP_free(EC_GROUP * group)
BN_free(&group->order);
BN_free(&group->cofactor);
- if (group->seed)
- free(group->seed);
+ free(group->seed);
free(group);
}
@@ -218,8 +217,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src)
dest->asn1_form = src->asn1_form;
if (src->seed) {
- if (dest->seed)
- free(dest->seed);
+ free(dest->seed);
dest->seed = malloc(src->seed_len);
if (dest->seed == NULL)
return 0;
@@ -227,8 +225,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src)
return 0;
dest->seed_len = src->seed_len;
} else {
- if (dest->seed)
- free(dest->seed);
+ free(dest->seed);
dest->seed = NULL;
dest->seed_len = 0;
}
diff --git a/lib/libcrypto/engine/hw_cryptodev.c b/lib/libcrypto/engine/hw_cryptodev.c
index 7d550451649..7da9913d285 100644
--- a/lib/libcrypto/engine/hw_cryptodev.c
+++ b/lib/libcrypto/engine/hw_cryptodev.c
@@ -926,8 +926,7 @@ zapparams(struct crypt_kop *kop)
int i;
for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) {
- if (kop->crk_param[i].crp_p)
- free(kop->crk_param[i].crp_p);
+ free(kop->crk_param[i].crp_p);
kop->crk_param[i].crp_p = NULL;
kop->crk_param[i].crp_nbits = 0;
}
diff --git a/lib/libcrypto/evp/evp_enc.c b/lib/libcrypto/evp/evp_enc.c
index 0c3e8fcc392..afe34f6f3fc 100644
--- a/lib/libcrypto/evp/evp_enc.c
+++ b/lib/libcrypto/evp/evp_enc.c
@@ -548,8 +548,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
if (c->cipher_data)
OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
}
- if (c->cipher_data)
- free(c->cipher_data);
+ free(c->cipher_data);
#ifndef OPENSSL_NO_ENGINE
if (c->engine)
/* The EVP_CIPHER we used belongs to an ENGINE, release the
diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c
index a42b4f03f44..894d51d532f 100644
--- a/lib/libcrypto/ocsp/ocsp_ht.c
+++ b/lib/libcrypto/ocsp/ocsp_ht.c
@@ -110,8 +110,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
{
if (rctx->mem)
BIO_free(rctx->mem);
- if (rctx->iobuf)
- free(rctx->iobuf);
+ free(rctx->iobuf);
free(rctx);
}
diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c
index 5580b7783ad..e75596afa38 100644
--- a/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/lib/libcrypto/rsa/rsa_pmeth.c
@@ -148,8 +148,7 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx)
{
if (rctx->pub_exp)
BN_free(rctx->pub_exp);
- if (rctx->tbuf)
- free(rctx->tbuf);
+ free(rctx->tbuf);
free(rctx);
}
}
diff --git a/lib/libcrypto/x509/by_dir.c b/lib/libcrypto/x509/by_dir.c
index fdfca6140ad..554f6600dc9 100644
--- a/lib/libcrypto/x509/by_dir.c
+++ b/lib/libcrypto/x509/by_dir.c
@@ -184,8 +184,7 @@ by_dir_hash_cmp(const BY_DIR_HASH * const *a,
static void
by_dir_entry_free(BY_DIR_ENTRY *ent)
{
- if (ent->dir)
- free(ent->dir);
+ free(ent->dir);
if (ent->hashes)
sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
free(ent);
diff --git a/lib/libcrypto/x509/x509_vpm.c b/lib/libcrypto/x509/x509_vpm.c
index c2cebd936fc..3ee3116ac17 100644
--- a/lib/libcrypto/x509/x509_vpm.c
+++ b/lib/libcrypto/x509/x509_vpm.c
@@ -212,8 +212,7 @@ X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, const X509_VERIFY_PARAM *from)
int
X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
{
- if (param->name)
- free(param->name);
+ free(param->name);
param->name = BUF_strdup(name);
if (param->name)
return 1;