diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index d2d8048..c69a380 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -346,7 +346,10 @@ if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) { if ([[elem name] isEqual: @"proceed"]) { /* FIXME: Catch errors here */ - sock = [[SSLSocket alloc] initWithSocket: sock]; + SSLSocket *newSock = [[SSLSocket alloc] + initWithSocket: sock]; + [sock release]; + sock = newSock; /* Stream restart */ [parser setDelegate: self];