When using gnutls_session_get_data2() to allocate
ctx->cache.client.data, we must free it with gnutls_free to deallocate
it.
When using an older gnutls without that method, we allocate the data
ourselves and must continue to use ne_free().
Originally reported by Werner Baumann.
Change-Id: Ifdfa9916f488767f8d501fd083cce3cfd9c7ba74
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
{
gnutls_certificate_free_credentials(ctx->cred);
if (ctx->cache.client.data) {
+#if defined(HAVE_GNUTLS_SESSION_GET_DATA2)
+ gnutls_free(ctx->cache.client.data);
+#else
ne_free(ctx->cache.client.data);
+#endif
} else if (ctx->cache.server.key.data) {
gnutls_free(ctx->cache.server.key.data);
gnutls_free(ctx->cache.server.data.data);