From 8174e79450148c3c736089345692662cd8887175 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 26 Sep 2019 18:41:52 +0200 Subject: winipcfg: ensure we're passing copy to go routines The windows-allocated one gets freed. Reported-by: Odd Stranne Signed-off-by: Jason A. Donenfeld --- tunnel/winipcfg/interface_change_handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tunnel/winipcfg/interface_change_handler.go') diff --git a/tunnel/winipcfg/interface_change_handler.go b/tunnel/winipcfg/interface_change_handler.go index 50ea6448..57041719 100644 --- a/tunnel/winipcfg/interface_change_handler.go +++ b/tunnel/winipcfg/interface_change_handler.go @@ -64,9 +64,10 @@ func (callback *InterfaceChangeCallback) Unregister() error { } func interfaceChanged(callerContext uintptr, row *MibIPInterfaceRow, notificationType MibNotificationType) uintptr { + rowCopy := *row interfaceChangeMutex.Lock() for cb := range interfaceChangeCallbacks { - go cb.cb(notificationType, row) + go cb.cb(notificationType, &rowCopy) } interfaceChangeMutex.Unlock() return 0 -- cgit v1.2.3-59-g8ed1b