aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-18 23:22:03 +0900
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-18 23:23:03 +0900
commitd3dd991e4e6f670c5daba9ba81aaa226b85eb200 (patch)
tree9db660ff59e61f4cde1f6b99b98db4146bdd56cd
parentsetupapi: Revise DrvInfoDetailData struct size calculation (diff)
downloadwireguard-go-d3dd991e4e6f670c5daba9ba81aaa226b85eb200.tar.xz
wireguard-go-d3dd991e4e6f670c5daba9ba81aaa226b85eb200.zip
device: send: check packet length before freeing element
-rw-r--r--device/send.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/device/send.go b/device/send.go
index b4e23c7..ccb28da 100644
--- a/device/send.go
+++ b/device/send.go
@@ -601,6 +601,9 @@ func (peer *Peer) RoutineSequentialSender() {
length := uint64(len(elem.packet))
err := peer.SendBuffer(elem.packet)
+ if len(elem.packet) != MessageKeepaliveSize {
+ peer.timersDataSent()
+ }
device.PutMessageBuffer(elem.buffer)
device.PutOutboundElement(elem)
if err != nil {
@@ -609,9 +612,6 @@ func (peer *Peer) RoutineSequentialSender() {
}
atomic.AddUint64(&peer.stats.txBytes, length)
- if len(elem.packet) != MessageKeepaliveSize {
- peer.timersDataSent()
- }
peer.keepKeyFreshSending()
}
}