diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:30:03 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:31:07 +0200 |
commit | 2ace745022f5af0709297e96eb0b0829c87c4291 (patch) | |
tree | 4352672cd8681d1df32edd39443c50a98fe0b065 /apps/ca.c | |
parent | Fix bug, "what mode" test was wrong. (diff) | |
download | openssl-2ace745022f5af0709297e96eb0b0829c87c4291.tar.xz openssl-2ace745022f5af0709297e96eb0b0829c87c4291.zip |
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.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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; } |