aboutsummaryrefslogtreecommitdiffstats
path: root/apps
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
parent5a80d9fbfe445420ffe6b649f29e2e0c412aba5d (diff)
downloadopenssl-2ace745022f5af0709297e96eb0b0829c87c4291.tar.gz
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')
-rw-r--r--apps/apps.c6
-rw-r--r--apps/asn1pars.c3
-rw-r--r--apps/ca.c16
3 files changed, 10 insertions, 15 deletions
diff --git a/apps/apps.c b/apps/apps.c
index ff832bd0be..5eadc72cfd 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -1414,8 +1414,7 @@ BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
}
err:
BIO_free(in);
- if (ai != NULL)
- ASN1_INTEGER_free(ai);
+ ASN1_INTEGER_free(ai);
return (ret);
}
@@ -1468,8 +1467,7 @@ int save_serial(char *serialfile, char *suffix, BIGNUM *serial,
}
err:
BIO_free_all(out);
- if (ai != NULL)
- ASN1_INTEGER_free(ai);
+ ASN1_INTEGER_free(ai);
return (ret);
}
diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index 6214625c54..7e1dfb7327 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -327,8 +327,7 @@ int asn1parse_main(int argc, char **argv)
OPENSSL_free(header);
if (strictpem && str != NULL)
OPENSSL_free(str);
- if (at != NULL)
- ASN1_TYPE_free(at);
+ ASN1_TYPE_free(at);
if (osk != NULL)
sk_OPENSSL_STRING_free(osk);
OBJ_cleanup();
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;
}