summaryrefslogtreecommitdiffstats
path: root/apps/ca.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-04-30 11:30:03 -0400
committerRich Salz <rsalz@openssl.org>2015-04-30 11:31:07 -0400
commit2ace745022f5af0709297e96eb0b0829c87c4291 (patch)
tree4352672cd8681d1df32edd39443c50a98fe0b065 /apps/ca.c
parent5a80d9fbfe445420ffe6b649f29e2e0c412aba5d (diff)
free NULL cleanup 8
Do not check for NULL before calling a free routine. This addresses: ASN1_BIT_STRING_free ASN1_GENERALIZEDTIME_free ASN1_INTEGER_free ASN1_OBJECT_free ASN1_OCTET_STRING_free ASN1_PCTX_free ASN1_SCTX_free ASN1_STRING_clear_free ASN1_STRING_free ASN1_TYPE_free ASN1_UTCTIME_free M_ASN1_free_of Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/ca.c')
-rw-r--r--apps/ca.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/apps/ca.c b/apps/ca.c
index 9c96417258..553560304a 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -2033,8 +2033,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
X509_NAME_free(subject);
if ((dn_subject != NULL) && !email_dn)
X509_NAME_free(dn_subject);
- if (tmptm != NULL)
- ASN1_UTCTIME_free(tmptm);
+ ASN1_UTCTIME_free(tmptm);
if (ok <= 0) {
if (ret != NULL)
X509_free(ret);
@@ -2740,6 +2739,8 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
}
if (phold)
*phold = hold;
+ else
+ ASN1_OBJECT_free(hold);
} else if ((reason_code == 9) || (reason_code == 10)) {
if (!arg_str) {
BIO_printf(bio_err, "missing compromised time\n");
@@ -2763,10 +2764,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
if (preason)
*preason = reason_code;
- if (pinvtm)
+ if (pinvtm) {
*pinvtm = comp_time;
- else
- ASN1_GENERALIZEDTIME_free(comp_time);
+ comp_time = NULL;
+ }
ret = 1;
@@ -2774,10 +2775,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
if (tmp)
OPENSSL_free(tmp);
- if (!phold)
- ASN1_OBJECT_free(hold);
- if (!pinvtm)
- ASN1_GENERALIZEDTIME_free(comp_time);
+ ASN1_GENERALIZEDTIME_free(comp_time);
return ret;
}