diff options
| author | miod <> | 2014-10-05 18:28:56 +0000 | 
|---|---|---|
| committer | miod <> | 2014-10-05 18:28:56 +0000 | 
| commit | 93cb8deb7a0d83b747a3ac064b06282577c7eed5 (patch) | |
| tree | 09d814e2756ec38bef091563e308ea0d57bb38df /src/lib/libc | |
| parent | 988338ef096541cbe56d451108b9f2f68bffe25e (diff) | |
| download | openbsd-93cb8deb7a0d83b747a3ac064b06282577c7eed5.tar.gz openbsd-93cb8deb7a0d83b747a3ac064b06282577c7eed5.tar.bz2 openbsd-93cb8deb7a0d83b747a3ac064b06282577c7eed5.zip | |
In v2i_AUTHORITY_INFO_ACCESS(), separate object allocation from object push
on a stack; if the latter fails, we need to free the object before returning
failure.
ok guenther@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_info.c | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/src/lib/libcrypto/x509v3/v3_info.c b/src/lib/libcrypto/x509v3/v3_info.c index 8e590ed808..862f949b1b 100644 --- a/src/lib/libcrypto/x509v3/v3_info.c +++ b/src/lib/libcrypto/x509v3/v3_info.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_info.c,v 1.18 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_info.c,v 1.19 2014/10/05 18:28:56 miod Exp $ */ | 
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 
| 3 | * project 1999. | 3 | * project 1999. | 
| 4 | */ | 4 | */ | 
| @@ -159,8 +159,13 @@ v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | |||
| 159 | } | 159 | } | 
| 160 | for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { | 160 | for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { | 
| 161 | cnf = sk_CONF_VALUE_value(nval, i); | 161 | cnf = sk_CONF_VALUE_value(nval, i); | 
| 162 | if (!(acc = ACCESS_DESCRIPTION_new()) || | 162 | if ((acc = ACCESS_DESCRIPTION_new()) == NULL) { | 
| 163 | !sk_ACCESS_DESCRIPTION_push(ainfo, acc)) { | 163 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, | 
| 164 | ERR_R_MALLOC_FAILURE); | ||
| 165 | goto err; | ||
| 166 | } | ||
| 167 | if (sk_ACCESS_DESCRIPTION_push(ainfo, acc) == 0) { | ||
| 168 | ACCESS_DESCRIPTION_free(acc); | ||
| 164 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, | 169 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, | 
| 165 | ERR_R_MALLOC_FAILURE); | 170 | ERR_R_MALLOC_FAILURE); | 
| 166 | goto err; | 171 | goto err; | 
