mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 02:15:07 -05:00
tls: don't call gnutls_deinit() after failed gnutls_init()
Don't assume gnutls_init() leaves the session pointer at NULL when it
returns with an error status. It might be a session that was already
allocated and then freed without resetting it to NULL after an error.
Fixes: 3e32e7e694 ("tls: move gnutls code into tls_gnutls.c")
This commit is contained in:
@@ -180,6 +180,7 @@ TLS_CreateInstance(int server_mode, int sock_fd, const char *server_name,
|
|||||||
(server_mode ? GNUTLS_SERVER : GNUTLS_CLIENT));
|
(server_mode ? GNUTLS_SERVER : GNUTLS_CLIENT));
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
LOG(LOGS_ERR, "Could not %s TLS session : %s", "create", gnutls_strerror(r));
|
LOG(LOGS_ERR, "Could not %s TLS session : %s", "create", gnutls_strerror(r));
|
||||||
|
inst->session = NULL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user