Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -344,11 +344,14 @@ } 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]; [self XMPP_startStream]; return;