}
err:
BIO_free(in);
- if (ai != NULL)
- ASN1_INTEGER_free(ai);
+ ASN1_INTEGER_free(ai);
return (ret);
}
}
err:
BIO_free_all(out);
- if (ai != NULL)
- ASN1_INTEGER_free(ai);
+ ASN1_INTEGER_free(ai);
return (ret);
}
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();
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);
}
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");
if (preason)
*preason = reason_code;
- if (pinvtm)
+ if (pinvtm) {
*pinvtm = comp_time;
- else
- ASN1_GENERALIZEDTIME_free(comp_time);
+ comp_time = NULL;
+ }
ret = 1;
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;
}
return (ret);
err:
ASN1err(ASN1_F_C2I_ASN1_OBJECT, i);
- if ((ret != NULL) && ((a == NULL) || (*a != ret)))
+ if ((a == NULL) || (*a != ret))
ASN1_OBJECT_free(ret);
return (NULL);
}
if (der)
OPENSSL_free(der);
- if (sk)
- sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
+ sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
if (sect)
X509V3_section_free(cnf, sect);
void ASN1_PCTX_free(ASN1_PCTX *p)
{
- OPENSSL_free(p);
+ if (p)
+ OPENSSL_free(p);
}
unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p)
void ASN1_SCTX_free(ASN1_SCTX *p)
{
- OPENSSL_free(p);
+ if (p)
+ OPENSSL_free(p);
}
const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p)
if (ptype == 0)
return 1;
if (ptype == V_ASN1_UNDEF) {
- if (alg->parameter) {
- ASN1_TYPE_free(alg->parameter);
- alg->parameter = NULL;
- }
+ ASN1_TYPE_free(alg->parameter);
+ alg->parameter = NULL;
} else
ASN1_TYPE_set(alg->parameter, ptype, pval);
return 1;
void X509_trust_clear(X509 *x)
{
- if (x->aux && x->aux->trust) {
+ if (x->aux) {
sk_ASN1_OBJECT_pop_free(x->aux->trust, ASN1_OBJECT_free);
x->aux->trust = NULL;
}
void X509_reject_clear(X509 *x)
{
- if (x->aux && x->aux->reject) {
+ if (x->aux) {
sk_ASN1_OBJECT_pop_free(x->aux->reject, ASN1_OBJECT_free);
x->aux->reject = NULL;
}
merr:
CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT, ERR_R_MALLOC_FAILURE);
err:
- if (ri)
- M_ASN1_free_of(ri, CMS_RecipientInfo);
+ M_ASN1_free_of(ri, CMS_RecipientInfo);
EVP_PKEY_free(pk);
return NULL;
merr:
CMSerr(CMS_F_CMS_ADD0_RECIPIENT_KEY, ERR_R_MALLOC_FAILURE);
err:
- if (ri)
- M_ASN1_free_of(ri, CMS_RecipientInfo);
+ M_ASN1_free_of(ri, CMS_RecipientInfo);
return NULL;
}
err:
if (rr)
CMS_ReceiptRequest_free(rr);
- if (rct)
- M_ASN1_free_of(rct, CMS_Receipt);
+ M_ASN1_free_of(rct, CMS_Receipt);
return r;
if (!pos)
return 0;
if (detached) {
- if (*pos) {
- ASN1_OCTET_STRING_free(*pos);
- *pos = NULL;
- }
+ ASN1_OCTET_STRING_free(*pos);
+ *pos = NULL;
return 1;
}
if (!*pos)
goto err;
if (!ASN1_STRING_copy(ias->serialNumber, X509_get_serialNumber(cert)))
goto err;
- if (*pias)
- M_ASN1_free_of(*pias, CMS_IssuerAndSerialNumber);
+ M_ASN1_free_of(*pias, CMS_IssuerAndSerialNumber);
*pias = ias;
return 1;
err:
- if (ias)
- M_ASN1_free_of(ias, CMS_IssuerAndSerialNumber);
+ M_ASN1_free_of(ias, CMS_IssuerAndSerialNumber);
CMSerr(CMS_F_CMS_SET1_IAS, ERR_R_MALLOC_FAILURE);
return 0;
}
CMSerr(CMS_F_CMS_SET1_KEYID, ERR_R_MALLOC_FAILURE);
return 0;
}
- if (*pkeyid)
- ASN1_OCTET_STRING_free(*pkeyid);
+ ASN1_OCTET_STRING_free(*pkeyid);
*pkeyid = keyid;
return 1;
}
merr:
CMSerr(CMS_F_CMS_ADD1_SIGNER, ERR_R_MALLOC_FAILURE);
err:
- if (si)
- M_ASN1_free_of(si, CMS_SignerInfo);
+ M_ASN1_free_of(si, CMS_SignerInfo);
return NULL;
}
}
alg = X509_ALGOR_new();
if (!alg) {
- if (key)
- ASN1_INTEGER_free(key);
+ ASN1_INTEGER_free(key);
return 0;
}
return 1;
err:
- if (public_key)
- ASN1_INTEGER_free(public_key);
+ ASN1_INTEGER_free(public_key);
DH_free(dh);
return 0;
if (dp != NULL)
OPENSSL_free(dp);
ASN1_STRING_free(params);
- if (prkey != NULL)
- ASN1_STRING_clear_free(prkey);
+ ASN1_STRING_clear_free(prkey);
return 0;
}
if (EVP_PKEY_derive_set_peer(pctx, pkpeer) > 0)
rv = 1;
err:
- if (public_key)
- ASN1_INTEGER_free(public_key);
+ ASN1_INTEGER_free(public_key);
EVP_PKEY_free(pkpeer);
DH_free(dhpeer);
return rv;
return 1;
err:
- if (public_key)
- ASN1_INTEGER_free(public_key);
+ ASN1_INTEGER_free(public_key);
DSA_free(dsa);
return 0;
DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR);
dsaerr:
BN_CTX_free(ctx);
- if (privkey)
- ASN1_STRING_clear_free(privkey);
+ ASN1_STRING_clear_free(privkey);
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
DSA_free(dsa);
return 0;
if (dp != NULL)
OPENSSL_free(dp);
ASN1_STRING_free(params);
- if (prkey != NULL)
- ASN1_STRING_clear_free(prkey);
+ ASN1_STRING_clear_free(prkey);
return 0;
}
/* clear the old values (if necessary) */
ASN1_OBJECT_free(field->fieldType);
- if (field->p.other != NULL)
- ASN1_TYPE_free(field->p.other);
+ ASN1_TYPE_free(field->p.other);
nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
/* set OID for the field */
goto err;
}
} else {
- if (curve->seed) {
- ASN1_BIT_STRING_free(curve->seed);
- curve->seed = NULL;
- }
+ ASN1_BIT_STRING_free(curve->seed);
+ curve->seed = NULL;
}
ok = 1;
}
x = X509V3_EXT_i2d(NID_id_pkix_OCSP_acceptableResponses, 0, sk);
err:
- if (sk)
- sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
+ sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
return x;
}
goto err;
x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
err:
- if (gt)
- ASN1_GENERALIZEDTIME_free(gt);
+ ASN1_GENERALIZEDTIME_free(gt);
return x;
}
OPENSSL_free(in);
return oct;
err:
- if (oct)
- ASN1_OCTET_STRING_free(oct);
+ ASN1_OCTET_STRING_free(oct);
return NULL;
}
int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy)
{
- if (ctx->default_policy)
- ASN1_OBJECT_free(ctx->default_policy);
+ ASN1_OBJECT_free(ctx->default_policy);
if (!(ctx->default_policy = OBJ_dup(def_policy)))
goto err;
return 1;
param->inh_flags = 0;
param->flags = 0;
param->depth = -1;
- if (param->policies) {
- sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
- param->policies = NULL;
- }
+ sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
+ param->policies = NULL;
paramid = param->id;
- if (paramid->hosts) {
- string_stack_free(paramid->hosts);
- paramid->hosts = NULL;
- }
+ string_stack_free(paramid->hosts);
+ paramid->hosts = NULL;
if (paramid->peername)
OPENSSL_free(paramid->peername);
if (paramid->email) {
{
int i;
ASN1_OBJECT *oid, *doid;
+
if (!param)
return 0;
- if (param->policies)
- sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
+ sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
if (!policies) {
param->policies = NULL;
err:
if (ret != NULL)
X509_ATTRIBUTE_free(ret);
- if (val != NULL)
- ASN1_TYPE_free(val);
+ ASN1_TYPE_free(val);
return (NULL);
}
if (ext_pcons)
POLICY_CONSTRAINTS_free(ext_pcons);
- if (ext_any)
- ASN1_INTEGER_free(ext_any);
+ ASN1_INTEGER_free(ext_any);
return 1;
goto end;
err:
ASN1_OBJECT_free(language);
- if (pathlen) {
- ASN1_INTEGER_free(pathlen);
- pathlen = NULL;
- }
- if (policy) {
- ASN1_OCTET_STRING_free(policy);
- policy = NULL;
- }
- if (pci) {
- PROXY_CERT_INFO_EXTENSION_free(pci);
- pci = NULL;
- }
+ ASN1_INTEGER_free(pathlen);
+ pathlen = NULL;
+ ASN1_OCTET_STRING_free(policy);
+ policy = NULL;
+ PROXY_CERT_INFO_EXTENSION_free(pci);
+ pci = NULL;
end:
sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
return pci;
err:
if (iptmp)
OPENSSL_free(iptmp);
- if (ret)
- ASN1_OCTET_STRING_free(ret);
+ ASN1_OCTET_STRING_free(ret);
return NULL;
}