summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_cert.c
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2017-10-26 19:56:14 +0200
committerRich Salz <rsalz@openssl.org>2017-10-26 20:34:35 +0200
commit7a908204ed3afe1379151c6d090148edb2fcc87e (patch)
treec59897274c934708a1c630cba56748d784e3c4b7 /ssl/ssl_cert.c
parentFix a couple nits in DEFINE_STACK_OF.pod (diff)
downloadopenssl-7a908204ed3afe1379151c6d090148edb2fcc87e.tar.xz
openssl-7a908204ed3afe1379151c6d090148edb2fcc87e.zip
Simplify the stack reservation
Use the newly introduced sk_TYPE_new_reserve API to simplify the reservation of stack as creating it. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4592)
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r--ssl/ssl_cert.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index 43b084d607..7b896087bd 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -463,15 +463,11 @@ STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk)
STACK_OF(X509_NAME) *ret;
X509_NAME *name;
- ret = sk_X509_NAME_new_null();
+ ret = sk_X509_NAME_new_reserve(NULL, num);
if (ret == NULL) {
SSLerr(SSL_F_SSL_DUP_CA_LIST, ERR_R_MALLOC_FAILURE);
return NULL;
}
- if (!sk_X509_NAME_reserve(ret, num)) {
- sk_X509_NAME_free(ret);
- return NULL;
- }
for (i = 0; i < num; i++) {
name = X509_NAME_dup(sk_X509_NAME_value(sk, i));
if (name == NULL) {