summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2004-10-26 12:46:44 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2004-10-26 12:46:44 +0000
commitc96d3e5be513ed7119bc8cc9a00a71880fdc0b5e (patch)
tree5983612995dc9c983531b7437dac8659e5328633
parente955e27fe5a6394bdcdf1d98a443fbf7ec1902e5 (diff)
downloadgnutls-c96d3e5be513ed7119bc8cc9a00a71880fdc0b5e.tar.gz
some minor fixes.
-rw-r--r--lib/gnutls_x509.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index 5fa0e5e2dc..7476bc9468 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -1309,25 +1309,29 @@ int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res,
gnutls_x509_crt_t * ca_list,
int ca_list_size)
{
- int ret, i, ret2;
+ int ret, i,j, ret2;
res->x509_ca_list = gnutls_realloc_fast(res->x509_ca_list,
- (ca_list_size +
- res->x509_ncas) *
- sizeof(gnutls_x509_crt_t));
+ (ca_list_size + res->x509_ncas) * sizeof(gnutls_x509_crt_t));
if (res->x509_ca_list == NULL) {
gnutls_assert();
return GNUTLS_E_MEMORY_ERROR;
}
for (i = 0; i < ca_list_size; i++) {
- gnutls_x509_crt_init(&res->x509_ca_list[i + res->x509_ncas]);
- ret = _gnutls_x509_crt_cpy(res->x509_ca_list[i + res->x509_ncas],
- ca_list[i]);
+ ret = gnutls_x509_crt_init(&res->x509_ca_list[i + res->x509_ncas]);
if (ret < 0) {
gnutls_assert();
return ret;
}
+
+ ret = _gnutls_x509_crt_cpy(res->x509_ca_list[i + res->x509_ncas],
+ ca_list[i]);
+ if (ret < 0) {
+ gnutls_assert();
+ gnutls_x509_crt_deinit( res->x509_ca_list[i + res->x509_ncas]);
+ return ret;
+ }
res->x509_ncas++;
}