summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pem
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-12 16:03:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-12 16:03:38 +0000
commit803c8dd8383f2beecc51eeb93a0d74de48fde813 (patch)
tree7f45d2fc5e781e1974149986eb31d41236a274ec /lib/libcrypto/pem
parent5ea82a759638e52c9147469bf1c240afd43f265c (diff)
if (x) FOO_free(x) -> FOO_free(x).
Improves readability, keeps the code smaller so that it is warmer in your cache. review & ok deraadt@
Diffstat (limited to 'lib/libcrypto/pem')
-rw-r--r--lib/libcrypto/pem/pem_pk8.c5
-rw-r--r--lib/libcrypto/pem/pem_pkey.c11
-rw-r--r--lib/libcrypto/pem/pvkfmt.c17
3 files changed, 12 insertions, 21 deletions
diff --git a/lib/libcrypto/pem/pem_pk8.c b/lib/libcrypto/pem/pem_pk8.c
index dafbd13814b..8d7ac4a954a 100644
--- a/lib/libcrypto/pem/pem_pk8.c
+++ b/lib/libcrypto/pem/pem_pk8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pem_pk8.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pk8.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -184,8 +184,7 @@ d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
if (!ret)
return NULL;
if (x) {
- if (*x)
- EVP_PKEY_free(*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
return ret;
diff --git a/lib/libcrypto/pem/pem_pkey.c b/lib/libcrypto/pem/pem_pkey.c
index 7e5e4f57718..a50742a63d1 100644
--- a/lib/libcrypto/pem/pem_pkey.c
+++ b/lib/libcrypto/pem/pem_pkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pem_pkey.c,v 1.17 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pkey.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -99,8 +99,7 @@ PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
@@ -128,8 +127,7 @@ PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
@@ -194,8 +192,7 @@ PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x)
goto err;
}
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
}
diff --git a/lib/libcrypto/pem/pvkfmt.c b/lib/libcrypto/pem/pvkfmt.c
index 32fcc181f74..ca7e908c294 100644
--- a/lib/libcrypto/pem/pvkfmt.c
+++ b/lib/libcrypto/pem/pvkfmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pvkfmt.c,v 1.10 2014/07/11 15:35:53 miod Exp $ */
+/* $OpenBSD: pvkfmt.c,v 1.11 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2005.
*/
@@ -349,12 +349,9 @@ b2i_dss(const unsigned char **in, unsigned int length, unsigned int bitlen,
memerr:
PEMerr(PEM_F_B2I_DSS, ERR_R_MALLOC_FAILURE);
- if (dsa)
- DSA_free(dsa);
- if (ret)
- EVP_PKEY_free(ret);
- if (ctx)
- BN_CTX_free(ctx);
+ DSA_free(dsa);
+ EVP_PKEY_free(ret);
+ BN_CTX_free(ctx);
return NULL;
}
@@ -402,10 +399,8 @@ b2i_rsa(const unsigned char **in, unsigned int length, unsigned int bitlen,
memerr:
PEMerr(PEM_F_B2I_RSA, ERR_R_MALLOC_FAILURE);
- if (rsa)
- RSA_free(rsa);
- if (ret)
- EVP_PKEY_free(ret);
+ RSA_free(rsa);
+ EVP_PKEY_free(ret);
return NULL;
}