Browse Source

http2: don't add *Response to activeRes in Transport on Headers.END_STREA

Prevents a memory leak.

Tests (to be updated) in Go standard library.

Updates golang/go#14084

Change-Id: I3ff602a013bb8fda7a17bccb31beadb08421ae6a
Reviewed-on: https://go-review.googlesource.com/19134
Reviewed-by: Blake Mizerany <blake.mizerany@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Brad Fitzpatrick 10 years ago
parent
commit
644ffc0620
1 changed files with 1 additions and 1 deletions
  1. 1 1
      http2/transport.go

+ 1 - 1
http2/transport.go

@@ -1264,10 +1264,10 @@ func (rl *clientConnReadLoop) processHeaderBlockFragment(frag []byte, streamID u
 			res.ContentLength = -1
 			res.Body = &gzipReader{body: res.Body}
 		}
+		rl.activeRes[cs.ID] = cs
 	}
 
 	cs.resTrailer = &res.Trailer
-	rl.activeRes[cs.ID] = cs
 	cs.resc <- resAndError{res: res}
 	rl.nextRes = nil // unused now; will be reset next HEADERS frame
 	return nil