Remove if() condition prior to calling BN_free() as
BN_free(a) does nothing if a is NULL.
Signed-off-by: Akash Saxena <akash.saxena@caviumnetworks.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
op->y.length,
pub_key);
if (!r || !s || !pub_key) {
- if (r)
- BN_free(r);
- if (s)
- BN_free(s);
- if (pub_key)
- BN_free(pub_key);
+ BN_free(r);
+ BN_free(s);
+ BN_free(pub_key);
cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
return -1;
BIGNUM *res = BN_CTX_get(sess->u.m.ctx);
if (unlikely(base == NULL || res == NULL)) {
- if (base)
- BN_free(base);
- if (res)
- BN_free(res);
+ BN_free(base);
+ BN_free(res);
cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
return -1;
}
BIGNUM *res = BN_CTX_get(sess->u.e.ctx);
if (unlikely(base == NULL || res == NULL)) {
- if (base)
- BN_free(base);
- if (res)
- BN_free(res);
+ BN_free(base);
+ BN_free(res);
cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
return -1;
}
asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_RSA;
break;
err_rsa:
- if (n)
- BN_free(n);
- if (e)
- BN_free(e);
- if (d)
- BN_free(d);
- if (p)
- BN_free(p);
- if (q)
- BN_free(q);
- if (dmp1)
- BN_free(dmp1);
- if (dmq1)
- BN_free(dmq1);
- if (iqmp)
- BN_free(iqmp);
+ BN_free(n);
+ BN_free(e);
+ BN_free(d);
+ BN_free(p);
+ BN_free(q);
+ BN_free(dmp1);
+ BN_free(dmq1);
+ BN_free(iqmp);
return -1;
}
err_dh:
OPENSSL_LOG(ERR, " failed to set dh params\n");
- if (p)
- BN_free(p);
- if (g)
- BN_free(g);
+ BN_free(p);
+ BN_free(g);
return -1;
}
case RTE_CRYPTO_ASYM_XFORM_DSA:
break;
err_dsa:
- if (p)
- BN_free(p);
- if (q)
- BN_free(q);
- if (g)
- BN_free(g);
- if (priv_key)
- BN_free(priv_key);
- if (pub_key)
- BN_free(pub_key);
+ BN_free(p);
+ BN_free(q);
+ BN_free(g);
+ BN_free(priv_key);
+ BN_free(pub_key);
return -1;
}
default: