mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1099414: Use RefPtr logic instead of delete when nr_socket_local_create fails. r=ekr
--HG-- extra : rebase_source : 8be15d27527166b0dfb322b90e6f5244bcabcc95
This commit is contained in:
parent
15fe8fb239
commit
48f06b46b6
@ -1107,7 +1107,7 @@ static nr_socket_vtbl nr_socket_local_vtbl={
|
||||
};
|
||||
|
||||
int nr_socket_local_create(nr_transport_addr *addr, nr_socket **sockp) {
|
||||
NrSocketBase *sock = nullptr;
|
||||
RefPtr<NrSocketBase> sock;
|
||||
|
||||
// create IPC bridge for content process
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
@ -1129,15 +1129,16 @@ int nr_socket_local_create(nr_transport_addr *addr, nr_socket **sockp) {
|
||||
if (r)
|
||||
ABORT(r);
|
||||
|
||||
// Add a reference so that we can delete it in destroy()
|
||||
sock->AddRef();
|
||||
|
||||
_status = 0;
|
||||
|
||||
abort:
|
||||
if (_status) {
|
||||
delete sock;
|
||||
{
|
||||
// We will release this reference in destroy(), not exactly the normal
|
||||
// ownership model, but it is what it is.
|
||||
NrSocketBase* dummy = sock.forget().take();
|
||||
(void)dummy;
|
||||
}
|
||||
|
||||
abort:
|
||||
return _status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user