Make sure all connection deinits are only called if there is something to deinit.

This commit is contained in:
Jim Hague 2018-12-14 15:38:32 +00:00
parent c1bf12c8a2
commit 65f4fbbc81
1 changed files with 3 additions and 1 deletions

View File

@ -248,6 +248,7 @@ _getdns_tls_connection* _getdns_tls_connection_new(struct mem_funcs* mfs, _getdn
res->shutdown = 0;
res->ctx = ctx;
res->mfs = mfs;
res->cred = NULL;
res->tls = NULL;
res->cipher_list = NULL;
res->curve_list = NULL;
@ -295,6 +296,7 @@ getdns_return_t _getdns_tls_connection_free(struct mem_funcs* mfs, _getdns_tls_c
dane_state_deinit(conn->dane_state);
if (conn->tls)
gnutls_deinit(conn->tls);
if (conn->cred)
gnutls_certificate_free_credentials(conn->cred);
GETDNS_FREE(*mfs, conn->tlsa);
GETDNS_FREE(*mfs, conn->curve_list);