Index: tls.c ================================================================== --- tls.c +++ tls.c @@ -1,9 +1,9 @@ /* * Copyright (C) 1997-1999 Matt Newman * - * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tls.c,v 1.4 2000/06/05 18:09:53 welch Exp $ + * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tls.c,v 1.5 2000/06/06 01:04:35 stanton Exp $ * * TLS (aka SSL) Channel - can be layered on any bi-directional * Tcl_Channel (Note: Requires Trf Core Patch) * * This was built (almost) from scratch based upon observation of @@ -726,12 +726,11 @@ statePtr->self = chan; Tcl_StackChannel( interp, Tls_ChannelType(), (ClientData) statePtr, (TCL_READABLE | TCL_WRITABLE), chan); #endif if (statePtr->self == (Tcl_Channel) NULL) { - Tls_Free(statePtr); -/* Tcl_EventuallyFree( (ClientData)statePtr, Tls_Free); */ + Tls_Free((char *) statePtr); return TCL_ERROR; } /* allocate script */ if (script) { @@ -755,12 +754,11 @@ if (!statePtr->ssl) { /* SSL library error */ Tcl_AppendResult(interp, "couldn't construct ssl session: ", REASON(), (char *) NULL); - Tls_Free(statePtr); -/* Tcl_EventuallyFree( (ClientData)statePtr, Tls_Free); */ + Tls_Free((char *) statePtr); return TCL_ERROR; } /* * SSL Callbacks @@ -1031,12 +1029,12 @@ void Tls_Free( char *blockPtr ) { State *statePtr = (State *)blockPtr; - Tls_Clean(blockPtr); - Tcl_Free((char *)statePtr); + Tls_Clean(statePtr); + Tcl_Free(blockPtr); } /* *------------------------------------------------------------------- * @@ -1054,14 +1052,12 @@ * Frees all the state * *------------------------------------------------------------------- */ void -Tls_Clean( char *blockPtr ) +Tls_Clean(State *statePtr) { - State *statePtr = (State *)blockPtr; - /* we're assuming here that we're single-threaded */ if (statePtr->ssl) { SSL_shutdown(statePtr->ssl); SSL_free(statePtr->ssl); statePtr->ssl = NULL; @@ -1073,11 +1069,10 @@ if (statePtr->timer != (Tcl_TimerToken)NULL) { Tcl_DeleteTimerHandler (statePtr->timer); statePtr->timer = NULL; } - } /* *------------------------------------------------------------------- * Index: tlsInt.h ================================================================== --- tlsInt.h +++ tlsInt.h @@ -1,9 +1,9 @@ /* * Copyright (C) 1997-2000 Matt Newman * - * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsInt.h,v 1.3 2000/05/04 20:21:06 aborr Exp $ + * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsInt.h,v 1.4 2000/06/06 01:04:35 stanton Exp $ * * TLS (aka SSL) Channel - can be layered on any bi-directional * Tcl_Channel (Note: Requires Trf Core Patch) * * This was built from scratch based upon observation of OpenSSL 0.9.2B @@ -108,10 +108,11 @@ /* * Forward declarations */ +EXTERN void Tls_Clean _ANSI_ARGS_((State *blockPtr)); EXTERN Tcl_ChannelType *Tls_ChannelType _ANSI_ARGS_((void)); EXTERN Tcl_Channel Tls_GetParent _ANSI_ARGS_((State *statePtr)); EXTERN Tcl_Obj* Tls_NewX509Obj _ANSI_ARGS_ (( Tcl_Interp *interp, X509 *cert)); EXTERN void Tls_Error _ANSI_ARGS_ ((State *statePtr, char *msg));