]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
(gnutls_certificate_set_openpgp_key): Allocate certificate structure
authorSimon Josefsson <simon@josefsson.org>
Tue, 10 Apr 2007 08:53:28 +0000 (08:53 +0000)
committerSimon Josefsson <simon@josefsson.org>
Tue, 10 Apr 2007 08:53:28 +0000 (08:53 +0000)
properly.  Tiny patch from ludo@chbouib.org (Ludovic Courtès).

libextra/gnutls_openpgp.c

index e9967cd6e34407115f0c86223953d560bce2e623..b76f57aa90e2a1f197fbcc2a4db9f84ee88b7d42 100644 (file)
@@ -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);