diff options
author | Nils Larsch <nils@openssl.org> | 2005-08-05 09:42:45 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-08-05 09:42:45 +0000 |
commit | 53b38d37a90ad53962b9e0f14eb942fa6ab8f341 (patch) | |
tree | 1f5d496302bf10e3500b3a1a9718dbceb0edc88d /crypto | |
parent | 8f2e4fdf860705a0d6868daba187e055781f7755 (diff) |
fix potential memory leak + improved error checking
PR: 1182
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509v3/v3_cpols.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/x509v3/v3_cpols.c b/crypto/x509v3/v3_cpols.c index 9784b1421a..e5b8c5a1ac 100644 --- a/crypto/x509v3/v3_cpols.c +++ b/crypto/x509v3/v3_cpols.c @@ -139,7 +139,15 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method, CONF_VALUE *cnf; int i, ia5org; pols = sk_POLICYINFO_new_null(); + if (pols == NULL) { + X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE); + return NULL; + } vals = X509V3_parse_list(value); + if (vals == NULL) { + X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB); + goto err; + } ia5org = 0; for(i = 0; i < sk_CONF_VALUE_num(vals); i++) { cnf = sk_CONF_VALUE_value(vals, i); @@ -178,6 +186,7 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method, sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); return pols; err: + sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); sk_POLICYINFO_pop_free(pols, POLICYINFO_free); return NULL; } |