Index: generic/tls.c ================================================================== --- generic/tls.c +++ generic/tls.c @@ -849,11 +849,11 @@ if (model != NULL) { int mode; /* Get the "model" context */ chan = Tcl_GetChannel(interp, model, &mode); if (chan == (Tcl_Channel) NULL) { - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } /* * Make sure to operate on the topmost channel @@ -861,18 +861,18 @@ chan = Tcl_GetTopChannel(chan); if (Tcl_GetChannelType(chan) != Tls_ChannelType()) { Tcl_AppendResult(interp, "bad channel \"", Tcl_GetChannelName(chan), "\": not a TLS channel", (char *)NULL); Tcl_SetErrorCode(interp, "TLS", "IMPORT", "CHANNEL", "INVALID", (char *)NULL); - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } ctx = ((State *)Tcl_GetChannelInstanceData(chan))->ctx; } else { if ((ctx = CTX_Init(statePtr, server, proto, keyfile, certfile, key, cert, key_len, cert_len, CApath, CAfile, ciphers, NULL, 0, DHparams)) == NULL) { - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } } statePtr->ctx = ctx; @@ -898,11 +898,11 @@ dprintf("Created channel named %s", Tcl_GetChannelName(statePtr->self)); if (statePtr->self == (Tcl_Channel) NULL) { /* * No use of Tcl_EventuallyFree because no possible Tcl_Preserve. */ - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } Tcl_SetChannelOption(interp, statePtr->self, "-translation", Tcl_DStringValue(&upperChannelTranslation)); Tcl_SetChannelOption(interp, statePtr->self, "-encoding", Tcl_DStringValue(&upperChannelEncoding)); @@ -915,11 +915,11 @@ statePtr->ssl = SSL_new(statePtr->ctx); if (!statePtr->ssl) { /* SSL library error */ Tcl_AppendResult(interp, "couldn't construct ssl session: ", GET_ERR_REASON(), (char *)NULL); Tcl_SetErrorCode(interp, "TLS", "IMPORT", "INIT", "FAILED", (char *)NULL); - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } /* Set host server name */ if (servername) { @@ -926,11 +926,11 @@ /* Sets the server name indication (SNI) in ClientHello extension */ /* Per RFC 6066, hostname is a ASCII encoded string, though RFC 4366 says UTF-8. */ if (!SSL_set_tlsext_host_name(statePtr->ssl, servername) && require) { Tcl_AppendResult(interp, "setting TLS host name extension failed", (char *)NULL); Tcl_SetErrorCode(interp, "TLS", "IMPORT", "HOSTNAME", "FAILED", (char *)NULL); - Tls_Free((void *)statePtr); + Tls_Free(statePtr); return TCL_ERROR; } } /* @@ -1630,10 +1630,11 @@ * Side effects: * Frees all the state * *------------------------------------------------------------------- */ +#undef Tls_Free void #if TCL_MAJOR_VERSION > 8 Tls_Free( void *blockPtr ) #else Tls_Free( char *blockPtr ) Index: generic/tlsInt.h ================================================================== --- generic/tlsInt.h +++ generic/tlsInt.h @@ -204,10 +204,11 @@ void Tls_Error(State *statePtr, const char *msg); #if TCL_MAJOR_VERSION > 8 void Tls_Free(void *blockPtr); #else void Tls_Free(char *blockPtr); +#define Tls_Free(blockPtr) (Tls_Free)((char *)blockPtr) #endif void Tls_Clean(State *statePtr); int Tls_WaitForConnect(State *statePtr, int *errorCodePtr, int handshakeFailureIsPermanent); BIO *BIO_new_tcl(State* statePtr, int flags);