mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182515 - WebSocketChannel leaked when WebSocketChannel::AsyncOpen fails, r=mcmanus
This commit is contained in:
parent
d5b39c2424
commit
b630760890
@ -3265,6 +3265,26 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI,
|
||||
// nsIChannelEventSink in this object in order to deal with redirects
|
||||
localChannel->SetNotificationCallbacks(this);
|
||||
|
||||
class MOZ_STACK_CLASS CleanUpOnFailure
|
||||
{
|
||||
public:
|
||||
explicit CleanUpOnFailure(WebSocketChannel* aWebSocketChannel)
|
||||
: mWebSocketChannel(aWebSocketChannel)
|
||||
{}
|
||||
|
||||
~CleanUpOnFailure()
|
||||
{
|
||||
if (!mWebSocketChannel->mWasOpened) {
|
||||
mWebSocketChannel->mChannel = nullptr;
|
||||
mWebSocketChannel->mHttpChannel = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
WebSocketChannel *mWebSocketChannel;
|
||||
};
|
||||
|
||||
CleanUpOnFailure cuof(this);
|
||||
|
||||
mChannel = do_QueryInterface(localChannel, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user