diff -r 425d8f4f7fa5 -r bb2423252ea3 networksecurity/tls/protocol/tlsconnection.cpp --- a/networksecurity/tls/protocol/tlsconnection.cpp Wed Sep 15 00:18:51 2010 +0300 +++ b/networksecurity/tls/protocol/tlsconnection.cpp Wed Sep 15 13:53:10 2010 +0300 @@ -55,7 +55,7 @@ CleanupStack::PushL(self); self->ConstructL(aSocket, aProtocol); - CleanupStack::Pop(); + CleanupStack::Pop(self); return self; } @@ -80,7 +80,7 @@ CleanupStack::PushL(self); self->ConstructL(aSocket, aProtocol); - CleanupStack::Pop(); + CleanupStack::Pop(self); return self; } @@ -1244,12 +1244,19 @@ return EFalse; } else - {//delete data path in case it's re-negotiation what's failed - delete iSendAppData; - iSendAppData = NULL; - delete iRecvAppData; - iRecvAppData = NULL; - ResetCryptoAttributes(); + { + //We came here since tls handshake failed for some reasons. + //Attempting to delete the application data state machines here, + //leads to sending incorrect status to the caller application. + //Allow the cleanup of handshake statemachine to continue here. + //Let the application data state machines be cleaned up by the + //tlsconnection desctructor function. + + //delete iSendAppData; + //iSendAppData = NULL; + //delete iRecvAppData; + //iRecvAppData = NULL; + //ResetCryptoAttributes(); } } else @@ -1363,7 +1370,7 @@ else { iRecordComposer->SetUserData( (TDesC8*)&aDesc ); - iRecordComposer->ResetCurrentPos(); + iRecordComposer->ResetCurrentPos(); iSendAppData->Start( &aStatus, this ); }