From: Simon Josefsson Date: Tue, 10 Apr 2007 08:53:28 +0000 (+0000) Subject: (gnutls_certificate_set_openpgp_key): Allocate certificate structure X-Git-Tag: gnutls_1_7_8~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cf0a597203099bf4fa2a4bcf4e7204ef9fdac3e;p=thirdparty%2Fgnutls.git (gnutls_certificate_set_openpgp_key): Allocate certificate structure properly. Tiny patch from ludo@chbouib.org (Ludovic Courtès). --- 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);