mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
fixed leak dispatching alerts
Fixed potential leak when disconnecting from the GUI, and at the same time dispatching an alert/message to the GUI.
This commit is contained in:
parent
68c2c8ae1a
commit
050e3c51b0
1 changed files with 4 additions and 1 deletions
|
@ -116,7 +116,10 @@ func (c *Client) alertsDispatcher() {
|
|||
}
|
||||
|
||||
func (c *Client) dispatchAlert(pbAlert protocol.Alert) {
|
||||
if c.client == nil {
|
||||
c.RLock()
|
||||
isDisconnected := c.client == nil
|
||||
c.RUnlock()
|
||||
if isDisconnected {
|
||||
return
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
|
|
Loading…
Add table
Reference in a new issue