summaryrefslogtreecommitdiff
path: root/libextra
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-04-10 08:53:28 +0000
committerSimon Josefsson <simon@josefsson.org>2007-04-10 08:53:28 +0000
commit9cf0a597203099bf4fa2a4bcf4e7204ef9fdac3e (patch)
tree4cf4fe2c24391974d3bc8fac7ea2c4021372f126 /libextra
parent2bc94f8b34ec8fed3653ff34b5f1836326d93f9a (diff)
downloadgnutls-9cf0a597203099bf4fa2a4bcf4e7204ef9fdac3e.tar.gz
(gnutls_certificate_set_openpgp_key): Allocate certificate structure
properly. Tiny patch from ludo@chbouib.org (Ludovic Courtès).
Diffstat (limited to 'libextra')
-rw-r--r--libextra/gnutls_openpgp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c
index e9967cd6e3..b76f57aa90 100644
--- a/libextra/gnutls_openpgp.c
+++ b/libextra/gnutls_openpgp.c
@@ -1257,7 +1257,13 @@ gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t
return GNUTLS_E_MEMORY_ERROR;
}
- res->cert_list[res->ncerts] = NULL; /* for realloc */
+ res->cert_list[res->ncerts] = gnutls_calloc (1, sizeof (gnutls_cert));
+ if (res->cert_list[res->ncerts] == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+
res->cert_list_length[res->ncerts] = 1;
ret = _gnutls_openpgp_key_to_gcert (res->cert_list[res->ncerts], key);