summaryrefslogtreecommitdiff
path: root/crypto/pem
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-05-01 10:02:07 -0400
committerRich Salz <rsalz@openssl.org>2015-05-01 10:02:07 -0400
commitb548a1f11c06ccdfa4f52a539912d22d77ee309e (patch)
tree37ff8792ddf09e4805aa3ba76b805923d3c52734 /crypto/pem
parent33fbca83dcd05b77f807fab205c4523b8cfe85b5 (diff)
downloadopenssl-new-b548a1f11c06ccdfa4f52a539912d22d77ee309e.tar.gz
free null cleanup finale
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_info.c18
-rw-r--r--crypto/pem/pem_seal.c6
-rw-r--r--crypto/pem/pem_sign.c3
-rw-r--r--crypto/pem/pvkfmt.c5
4 files changed, 11 insertions, 21 deletions
diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c
index 0e7338bd1d..29670ed35f 100644
--- a/crypto/pem/pem_info.c
+++ b/crypto/pem/pem_info.c
@@ -253,14 +253,11 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
} else {
/* unknown */
}
- if (name != NULL)
- OPENSSL_free(name);
- if (header != NULL)
- OPENSSL_free(header);
- if (data != NULL)
- OPENSSL_free(data);
+ OPENSSL_free(name);
name = NULL;
+ OPENSSL_free(header);
header = NULL;
+ OPENSSL_free(data);
data = NULL;
}
@@ -287,12 +284,9 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
ret = NULL;
}
- if (name != NULL)
- OPENSSL_free(name);
- if (header != NULL)
- OPENSSL_free(header);
- if (data != NULL)
- OPENSSL_free(data);
+ OPENSSL_free(name);
+ OPENSSL_free(header);
+ OPENSSL_free(data);
return (ret);
}
diff --git a/crypto/pem/pem_seal.c b/crypto/pem/pem_seal.c
index 374273d14f..a3812b80d2 100644
--- a/crypto/pem/pem_seal.c
+++ b/crypto/pem/pem_seal.c
@@ -112,8 +112,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
ret = npubk;
err:
- if (s != NULL)
- OPENSSL_free(s);
+ OPENSSL_free(s);
OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH);
return (ret);
}
@@ -181,8 +180,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
err:
EVP_MD_CTX_cleanup(&ctx->md);
EVP_CIPHER_CTX_cleanup(&ctx->cipher);
- if (s != NULL)
- OPENSSL_free(s);
+ OPENSSL_free(s);
return (ret);
}
#else /* !OPENSSL_NO_RSA */
diff --git a/crypto/pem/pem_sign.c b/crypto/pem/pem_sign.c
index 87cc7273de..e16be4a264 100644
--- a/crypto/pem/pem_sign.c
+++ b/crypto/pem/pem_sign.c
@@ -95,7 +95,6 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
ret = 1;
err:
/* ctx has been zeroed by EVP_SignFinal() */
- if (m != NULL)
- OPENSSL_free(m);
+ OPENSSL_free(m);
return (ret);
}
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index b44912bc50..9e9c948532 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -285,8 +285,7 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub)
ret = b2i_rsa(&p, length, bitlen, ispub);
err:
- if (buf)
- OPENSSL_free(buf);
+ OPENSSL_free(buf);
return ret;
}
@@ -737,7 +736,7 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in,
ret = b2i_PrivateKey(&p, keylen);
err:
EVP_CIPHER_CTX_cleanup(&cctx);
- if (enctmp && saltlen)
+ if (saltlen)
OPENSSL_free(enctmp);
return ret;
}