Commit 5eeb3724 authored by taoyuanyuan's avatar taoyuanyuan Committed by Ian Lance Taylor

internal/poll: avoid memory leak in Writev

The chunks that were referenced by fd.iovecs would not be GC.

Change-Id: I7bfcb91a3fef57a4a1861168e9cd3ab55ce1334e
GitHub-Last-Rev: e0b7f68447441fd89ed1a6e8aa37e2084fd863b2
GitHub-Pull-Request: golang/go#32138
Reviewed-on: https://go-review.googlesource.com/c/go/+/178037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 5ca44dc4
......@@ -64,6 +64,9 @@ func (fd *FD) Writev(v *[][]byte) (int64, error) {
TestHookDidWritev(int(wrote))
n += int64(wrote)
consume(v, int64(wrote))
for i := range iovecs {
iovecs[i] = syscall.Iovec{}
}
if err != nil {
if err.(syscall.Errno) == syscall.EAGAIN {
if err = fd.pd.waitWrite(fd.isFile); err == nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment