summaryrefslogtreecommitdiff
path: root/lib/libssl/ssl_cert.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-06-27 05:07:04 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-06-27 05:07:04 +0000
commit0fa0c9fb7d6f4ad7a423044f28b55eaaedc63f28 (patch)
tree98d6947cd8474ab98b57494ebef50e97659be043 /lib/libssl/ssl_cert.c
parentecc645c71513728e7357c84aa8997b4dc2301936 (diff)
resolve conflicts
Diffstat (limited to 'lib/libssl/ssl_cert.c')
-rw-r--r--lib/libssl/ssl_cert.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libssl/ssl_cert.c b/lib/libssl/ssl_cert.c
index b8b9bc23900..b779e6bb4da 100644
--- a/lib/libssl/ssl_cert.c
+++ b/lib/libssl/ssl_cert.c
@@ -616,14 +616,13 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
BIO *in;
X509 *x=NULL;
X509_NAME *xn=NULL;
- STACK_OF(X509_NAME) *ret,*sk;
+ STACK_OF(X509_NAME) *ret = NULL,*sk;
- ret=sk_X509_NAME_new_null();
sk=sk_X509_NAME_new(xname_cmp);
in=BIO_new(BIO_s_file_internal());
- if ((ret == NULL) || (sk == NULL) || (in == NULL))
+ if ((sk == NULL) || (in == NULL))
{
SSLerr(SSL_F_SSL_LOAD_CLIENT_CA_FILE,ERR_R_MALLOC_FAILURE);
goto err;
@@ -636,6 +635,15 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
{
if (PEM_read_bio_X509(in,&x,NULL,NULL) == NULL)
break;
+ if (ret == NULL)
+ {
+ ret = sk_X509_NAME_new_null();
+ if (ret == NULL)
+ {
+ SSLerr(SSL_F_SSL_LOAD_CLIENT_CA_FILE,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
if ((xn=X509_get_subject_name(x)) == NULL) goto err;
/* check for duplicates */
xn=X509_NAME_dup(xn);
@@ -658,6 +666,8 @@ err:
if (sk != NULL) sk_X509_NAME_free(sk);
if (in != NULL) BIO_free(in);
if (x != NULL) X509_free(x);
+ if (ret != NULL)
+ ERR_clear_error();
return(ret);
}
#endif