Browse Source

Fix memory leak on TLS setup error path

Need tof free TLS context in some cases to avoid a memory leak
on error path.
Jouni Malinen 15 years ago
parent
commit
c7d711609b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/eap_peer/eap_tls_common.c

+ 4 - 0
src/eap_peer/eap_tls_common.c

@@ -169,10 +169,14 @@ static int eap_tls_init_connection(struct eap_sm *sm,
 		config->pin = NULL;
 		eap_sm_request_pin(sm);
 		sm->ignore = TRUE;
+		tls_connection_deinit(sm->ssl_ctx, data->conn);
+		data->conn = NULL;
 		return -1;
 	} else if (res) {
 		wpa_printf(MSG_INFO, "TLS: Failed to set TLS connection "
 			   "parameters");
+		tls_connection_deinit(sm->ssl_ctx, data->conn);
+		data->conn = NULL;
 		return -1;
 	}